public static DataTable ConvertdrTodt(OleDbDataReader dataReader)
{
int num;
DataTable table = new DataTable();
for (num = 0; num < dataReader.FieldCount; num++)
{
DataColumn column = new DataColumn();
column.DataType = dataReader.GetFieldType(num);
column.ColumnName = dataReader.GetName(num);
table.Columns.Add(column);
}
while (dataReader.Read())
{
DataRow row = table.NewRow();
for (num = 0; num < dataReader.FieldCount; num++)
{
row[num] = dataReader[num].ToString();
}
table.Rows.Add(row);
row = null;
}
dataReader.Close();
return table;
}
datareader填充DataTable
最新推荐文章于 2019-07-01 16:11:48 发布