public static List <BusiCompColumn> GetBcColumn(SqlConnection conn, string bcOid) { List <BusiCompColumn> columns = new List <BusiCompColumn>(); StringBuilder sql = new StringBuilder("select "); sql.Append("FieldName,ChineseName,AllowEdit,Visible,"); sql.Append("FieldLength,DecLength,FieldType,Width,SortMode,fUseCodeTable,CodeTable,fAllowNull,DefaultValue,"); sql.Append("LookupField,LookupDataSet,fForeignKey,FieldKindEx,CustomSQLColumn,ExcelColNo,fFunctionInitValue,InitValueFunc,"); sql.Append("OnFieldChangeEx,BusinessColumnDataSetOID"); sql.Append(" from BusinessColumnDataSet "); sql.Append("where BusinessTableOID='" + bcOid + "'"); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BusiCompColumn column = new BusiCompColumn(); column.FieldName = Util.GetPropString(reader, 0); column.Caption = Util.GetPropString(reader, 1); column.fCanModify = Util.GetPropBool(reader, 2); column.fDisplay = Util.GetPropBool(reader, 3); column.FieldLength = Util.GetProperInt(reader, 4); column.DecLength = Util.GetProperInt(reader, 5); column.FieldType = Util.GetProperInt(reader, 6); column.Width = Util.GetProperInt(reader, 7); column.SortMode = Util.GetProperInt(reader, 8); column.fUseCodeTable = Util.GetPropBool(reader, 9); column.CodeTable = Util.GetPropString(reader, 10); column.fAllowNull = Util.GetPropBool(reader, 11); column.DefaultValue = Util.GetPropString(reader, 12); column.LookupKeyField = Util.GetPropString(reader, 13); column.LookupDataSet = Util.GetPropString(reader, 14); column.fForeignKey = Util.GetPropBool(reader, 15); column.FieldKind = Util.GetProperInt(reader, 16); column.CustomSQLColumn = Util.GetPropString(reader, 17); column.ExcelColNo = Util.GetProperInt(reader, 18); column.fFunctionInitValue = Util.GetPropBool(reader, 19); column.InitValueFunc = Util.GetPropString(reader, 20); column.OnFieldChangeScript = Util.GetPropString(reader, 21); column.OID = Util.GetProperGuid(reader, 22); columns.Add(column); } reader.Close(); foreach (BusiCompColumn column in columns) { column.BCLink = GetBCLink(conn, column.OID); } return(columns); }
public static List<BusiCompColumn> PrepareBcColumn(SqlConnection conn, int bcOid) { List<BusiCompColumn> columns = new List<BusiCompColumn>(); StringBuilder sql = new StringBuilder("select "); sql.Append("FieldName,ChineseName,AllowEdit,Visible,"); sql.Append("FieldLength,DecLength,FieldType,Width,SortMode,fUseCodeTable,CodeTable,fAllowNull,DefaultValue,"); sql.Append("LookupField,LookupDataSet,fForeignKey,FieldKindEx,CustomSQLColumn,ExcelColNo,fFunctionInitValue,InitValueFunc "); sql.Append("from BusinessColumnDataSet "); sql.Append("where BusinessTableOID=" + bcOid); SqlCommand cmd = new SqlCommand(sql.ToString(), conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BusiCompColumn column = new BusiCompColumn(); column.FieldName = Util.GetPropString(reader, 0); column.Caption = Util.GetPropString(reader, 1); column.fCanModify = Util.GetPropBool(reader, 2); column.fDisplay = Util.GetPropBool(reader, 3); column.FieldLength = Util.GetProperInt(reader, 4); column.DecLength = Util.GetProperInt(reader, 5); column.FieldType = Util.GetProperInt(reader, 6); column.Width = Util.GetProperInt(reader, 7); column.SortMode = Util.GetProperInt(reader, 8); column.fUseCodeTable = Util.GetPropBool(reader, 9); column.CodeTable = Util.GetPropString(reader, 10); column.fAllowNull = Util.GetPropBool(reader, 11); column.DefaultValue = Util.GetPropString(reader, 12); column.LookupKeyField = Util.GetPropString(reader, 13); column.LookupDataSet = Util.GetPropString(reader, 14); column.fForeignKey = Util.GetPropBool(reader, 15); column.FieldKind = Util.GetProperInt(reader, 16); column.CustomSQLColumn = Util.GetPropString(reader, 17); column.ExcelColNo = Util.GetProperInt(reader, 18); column.fFunctionInitValue = Util.GetPropBool(reader, 19); column.InitValueFunc = Util.GetPropString(reader, 20); columns.Add(column); } reader.Close(); return columns; }