public DataTable ReadTable() { return(HelperBase.ReadTable(cmd)); /* * DataTable dt=new DataTable(); * DbDataReader reader = null; * try * { * reader = cmd.ExecuteReader(); * int fieldc=reader.FieldCount; * for (int i = 0; i < fieldc; i++) * { * DataColumn dc = new DataColumn(reader.GetName(i), reader.GetFieldType(i)); * dt.Columns.Add(dc); * } * while (reader.Read()) * { * DataRow dr = dt.NewRow(); * for (int i = 0; i < fieldc; i++) * { * dr[i] = reader[i]; * } * dt.Rows.Add(dr); * } * return dt; * } * finally * { * if (reader != null) reader.Close(); * }*/ }
public static DataTable ReadTable(SqlConnection connection, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters) { SqlCommand cmd = new SqlCommand(); SqlServerHelper.PrepareCommand(cmd, connection, (SqlTransaction)null, cmdType, cmdText, commandParameters); DataTable dataTable = HelperBase.ReadTable((DbCommand)cmd); cmd.Parameters.Clear(); return(dataTable); }
public static DataTable ReadTable(OracleConnection connection, CommandType cmdType, string cmdText, params OracleParameter[] commandParameters) { OracleCommand cmd = new OracleCommand(); PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters); DataTable dt = HelperBase.ReadTable(cmd); cmd.Parameters.Clear(); return(dt); }
public static DataTable ReadTable(SqlTransaction transaction, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters) { SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, transaction.Connection, transaction, cmdType, cmdText, commandParameters); DataTable dt = HelperBase.ReadTable(cmd); cmd.Parameters.Clear(); return(dt); }
public DataTable ReadTable() { return(HelperBase.ReadTable(this.cmd)); }