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;