示例#1
0
        /// <summary>
        /// 初始化全部列
        /// </summary>
        protected override void InitializeColumn()
        {
            string sql = @"SELECT sys.syscolumns.name, sys.systypes.name AS type
                            FROM sys.syscolumns INNER JOIN
                            sys.sysobjects ON sys.syscolumns.id = sys.sysobjects.id AND sys.sysobjects.name = @0 AND 
                            sys.sysobjects.xtype = 'U' INNER JOIN
                            sys.systypes ON sys.systypes.xusertype = sys.syscolumns.xusertype";

            SQLDBOperator dbOperator = new SQLDBOperator(this.ConnectionString);

            object[][] rows = dbOperator.GetDataRows(sql, this.TableName);

            for (int i = 0; i < rows.Length; i++)
            {
                Enums.DataType type   = Enums.GetColumnDataTypeByNameString(rows[i][1].ToString());
                DBColumn       column = new DBColumn(rows[i][0].ToString(), type);
                this.Columns.Add(column);
            }
        }
示例#2
0
 /// <summary>
 /// 向集合中添加一个新对象,并返回新添加的对象。
 /// </summary>
 /// <param name="column">要添加的DBColumn对象</param>
 /// <returns></returns>
 public DBColumn Add(DBColumn column)
 {
     columnContainer.Add(column);
     return(column);
 }
示例#3
0
 /// <summary>
 /// 初始化数据字段
 /// </summary>
 /// <param name="column">字段所属列</param>
 ///<param name="value">值</param>
 public DBField(DBColumn column, object value)
 {
     this.column      = column;
     this.objectValue = value;
 }