/// <summary> /// 填充表数据Records /// </summary> /// <param name="sql">查询语句</param> protected override void FillRecords(string sql) { SQLDBOperator opt = new SQLDBOperator(this.ConnectionString); object[][] dataRows = opt.GetDataRows(sql); foreach (object[] dataRow in dataRows) { SQLDBRecord record = new SQLDBRecord(this.TableName, this.IdentifierName, this.ConnectionString, Columns); for (int i = 0; i < dataRow.Length; i++) { record.Fields[i].Value = dataRow[i]; } record.State = Enums.DBRecordState.Saved; this.Records.Add(record); } }
/// <summary> /// 创建一个DBRecord对象,该对象包含的列由初始化决定。 /// </summary> /// <returns></returns> public override DBRecord CreateRecord() { SQLDBRecord record = new SQLDBRecord(this.TableName, this.IdentifierName, this.ConnectionString, this.Columns); return(record); }