Beispiel #1
0
 public DataSet ExecDataSet(DbCommand cmd)
 {
     try
     {
         cmd.Connection = this.SQLConn;
         this.Open();
         SqlServerDataAdapter adp = new SqlServerDataAdapter((SqlCommand)cmd);
         DataSet ds = new DataSet();
         adp.Fill(ds);
         this.Close();
         return(ds);
     }
     catch (Exception e)
     {
         this.Close();
         throw e;
     }
 }
Beispiel #2
0
 public XORM.CBase.Data.Common.DataTable ExecDataTable(DbCommand cmd)
 {
     try
     {
         cmd.Connection = this.SQLConn;
         this.Open();
         SqlServerDataAdapter             adp = new SqlServerDataAdapter((SqlCommand)cmd);
         XORM.CBase.Data.Common.DataTable dt  = new XORM.CBase.Data.Common.DataTable();
         adp.Fill(dt);
         this.Close();
         return(dt);
     }
     catch (Exception e)
     {
         this.Close();
         throw e;
     }
 }
Beispiel #3
0
        public DataSet ExecProcDataSet(string ProcName, params object[] cmdParams)
        {
            SqlCommand cmd = new SqlCommand();

            try
            {
                CommonPreCmd(ProcName, cmd, null, CommandType.StoredProcedure, cmdParams);
                SqlServerDataAdapter da = new SqlServerDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);
                cmd.Parameters.Clear();
                this.Close();
                return(ds);
            }
            catch (Exception e)
            {
                this.Close();
                throw e;
            }
        }
Beispiel #4
0
        public XORM.CBase.Data.Common.DataTable ExecTextDataTable(string SQLText, params object[] cmdParams)
        {
            SqlCommand cmd = new SqlCommand();

            try
            {
                CommonPreCmd(SQLText, cmd, null, CommandType.Text, cmdParams);
                SqlServerDataAdapter             da = new SqlServerDataAdapter(cmd);
                XORM.CBase.Data.Common.DataTable dt = new XORM.CBase.Data.Common.DataTable();
                da.Fill(dt);
                cmd.Parameters.Clear();
                this.Close();
                return(dt);
            }
            catch (Exception e)
            {
                this.Close();
                throw e;
            }
        }