Beispiel #1
0
        public static DataTable RunSPReturnDataTable(string spName, Paras paras, IfxConnection conn)
        {
            try
            {
                IfxCommand salesCMD = new IfxCommand(spName, conn);
                salesCMD.CommandType = CommandType.StoredProcedure;

                /// 加上他们的餐数
                foreach (Para para in paras)
                {
                    IfxParameter myParm = salesCMD.Parameters.Add(para.ParaName, para.DAType);
                    myParm.Value = para.val;
                }

                //selectCMD.CommandTimeout =60;
                IfxDataAdapter sda = new IfxDataAdapter(salesCMD);
                if (conn.State == System.Data.ConnectionState.Closed)
                {
                    conn.Open();
                }
                DataTable dt = new DataTable();
                sda.Fill(dt);
                sda.Dispose();
                return(dt);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public static DataTable ExecuteQuery(IfxCommand command, IfxConnection conn, IfxTransaction trans)
        {
            DataTable result = new DataTable();

            command.Connection  = conn;
            command.Transaction = trans;
            IBM.Data.Informix.IfxDataAdapter datoIFX = default(IBM.Data.Informix.IfxDataAdapter);
            datoIFX = new IfxDataAdapter();
            datoIFX.SelectCommand = command;
            datoIFX.Fill(result);
            datoIFX.Dispose();
            return(result);
        }
Beispiel #3
0
        //EJECUTA UN QUERY
        public static DataTable ExecuteQuery(IfxCommand command, string chain)
        {
            DataTable     result      = new DataTable();
            IfxConnection conexionIFX = new IfxConnection();

            IBM.Data.Informix.IfxDataAdapter datoIFX = default(IBM.Data.Informix.IfxDataAdapter);
            conexionIFX = new IfxConnection(chain);
            conexionIFX.Open();
            command.Connection    = conexionIFX;
            datoIFX               = new IfxDataAdapter();
            datoIFX.SelectCommand = command;
            datoIFX.Fill(result);
            datoIFX.Dispose();
            conexionIFX.Close();
            return(result);
        }