日期:2014-05-18  浏览次数:21007 次

GetDataTableOfRecord
public static DataTable GetDataTableOfRecord(OracleConnection conn, OracleTransaction trans, CommandType cmdType, string cmdText, params OracleParameter[] cmdParms)
{
  OracleDataAdapter adapter = new OracleDataAdapter();
  adapter.SelectCommand = new OracleCommand();
  DataTable dataTable = null;
  try
  {
  PrepareCommand(adapter.SelectCommand, conn, trans, cmdType, cmdText, cmdParms);
  dataTable = new DataTable();
  adapter.Fill(dataTable);
  adapter.SelectCommand.Parameters.Clear();
  }
  catch (Exception exception)
  {
  dataTable = null;
  throw exception;
  }
  return dataTable;
}

 

 


------解决方案--------------------
获得数据库的数据并存放在dataTable中,这样就可以在程序中操作dataTable