Esempio n. 1
0
        protected bool KeyLoad(object key)
        {
            Initialize();
            _Initialized = true;
            using (DbManager mgr = new DbManager())
            {
                StringBuilder sb = new StringBuilder();
                foreach (string c in _ColumnMap.Keys)
                {
                    if (sb.Length > 0)
                    {
                        sb.Append(", [" + c + "]");
                    }
                    else
                    {
                        sb.Append("[" + c + "]");
                    }
                }

                DbRow dr = mgr.QuerySingle(string.Format("SELECT {0} FROM [{1}] WHERE [{2}] = {3}{4}{3}", sb.ToString(), _TableName, KeyColumn.Column, KeyColumn.Quoted ? "'" : "", key.ToString().Replace("'", "''")));
                return(Load(dr));
            }
        }