예제 #1
0
        public bool Call400Pgm(string cmdtext, IBM.Data.DB2.iSeries.iDB2Connection cn)
        {
            // ------------------------------------------------------------
            // This method runs a command on the iSeries using QCMDEXC.
            //
            // cmdtext is the command or program you want to call.
            // cn is an open iDB2Connection the command will be run on.
            // If the command runs without error, this method returns true.
            //------------------------------------------------------------
            bool rc = true;
            // Construct a string which contains the call to QCMDEXC.
            // Because QCMDEXC uses single quote characters, we must
            // delimit single quote characters in the command text
            // with an extra single quote.
            string      pgmParm = "CALL QSYS.QCMDEXC('" + cmdtext.Replace("'", "''") + "', " + cmdtext.Length.ToString("0000000000.00000") + ")";
            iDB2Command cmd     = new iDB2Command(pgmParm, cn);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                rc = false;
            }
            cmd.Dispose();
            return(rc);
        }
예제 #2
0
 public Client()
 {
     _connection = new IBM.Data.DB2.iSeries.iDB2Connection();
 }