public static DataSet CreateSimpleTable(string strDataSetName, string strTableName, TStringTypeElement stePrimaryKey, TStringTypeElement[] lstFields) { DataTable dttbSimpleTable = CreateSimpleTable(strTableName,stePrimaryKey,lstFields); DataSet dsResult = new DataSet(strDataSetName); dsResult.Tables.Add(dttbSimpleTable); return dsResult; }
public static DataTable CreateSimpleTable(string strTableName, TStringTypeElement stePrimaryKey, TStringTypeElement[] lstFields) { DataTable dttbResult = new DataTable(strTableName); if (stePrimaryKey!=null) { DataColumn pkCol = dttbResult.Columns.Add(stePrimaryKey.elmString, stePrimaryKey.elmType); dttbResult.PrimaryKey = new DataColumn[] {pkCol}; } if (lstFields!=null) { if (lstFields.Length>0) { foreach(TStringTypeElement steField in lstFields) { if (steField!=null) { dttbResult.Columns.Add(steField.elmString, steField.elmType); } } } } return dttbResult; }