在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
string data = string.Empty; DataTable OutDataTable = new DataTable(); OracleDataReader daReader = cmd.ExecuteReader(CommandBehavior.CloseConnection); OutDataTable = new DataTable(); DataRow dataRow; //设置Table名和Column名 OutDataTable.TableName ="test"; for (int j = 0; j < daReader.FieldCount; j++) { //获取列名 OutDataTable.Columns.Add(daReader.GetName(j)); } //循环取数据集合中的数据,存到DataTable中 do { while (daReader.Read()) { dataRow = OutDataTable.NewRow(); for (int j = 0; j < daReader.FieldCount; j++) { data = daReader[j].ToString(); dataRow[j] = data; } OutDataTable.Rows.Add(dataRow); } } while (daReader.NextResult()); dtTemp = OutDataTable;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论