Snippet1
2017-09-25 本文已影响0人
LiviaLiu
using (CargoSysDbContext db = new CargoSysDbContext())
{
DataSet ds = new DataSet();
if (db.Database.Connection.State == ConnectionState.Closed)
{
db.Database.Connection.Open();
}
OracleCommand myCommand = db.Database.Connection.CreateCommand() as OracleCommand;
//System.Data.Common.DbCommand dbCommand
OracleDataAdapter myAdapter = null;
try
{
myAdapter = new OracleDataAdapter();
myAdapter.SelectCommand = myCommand;
SetCommand(myCommand, item);
myAdapter.Fill(ds, "cx");
}
catch (Exception ex)
{
throw ex;
}
finally
{
myCommand.Dispose();
myAdapter.Dispose();
}
return ds;
}