Snippet1

作者: LiviaLiu | 来源:发表于2017-09-25 17:16 被阅读0次

    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;
            }

    相关文章

      网友评论

          本文标题:Snippet1

          本文链接:https://www.haomeiwen.com/subject/cwedextx.html