× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Apparently you can call a program without creating a stored procedure and 
pass parms to it both ways if you use the OLE DB provider instead of .Net 
provider. 
Seems to me that functionality was ripped out in the .Net provider since 
the .Net provider only seems to support stored procedure calls. 

Either way works well. 

Regards,
Richard Schoen
RJS Software Systems Inc. 
"Providing Your....iNFORMATION NOW!"
Email: richard@xxxxxxxxxxxxxxx
Web Site: http://www.rjssoftware.com
Tel: (952) 898-3038
Fax: (952) 898-1781
Toll Free: (888) RJSSOFT
------------------------------

message: 10
date: Mon, 19 Feb 2007 10:29:51 -0600
from: "Bruce Collins" <bruce.collins@xxxxxxxxxxxxx>
subject: RE: Call iSeries program from C# program 

Bob, the way I do it is to load the iSeries Access .Net Db2 Provider and
call a stored procedure on the iSeries. Below is a code snippet. You
have to create the stored procedure on the iSeries.

using IBM.Data.DB2.iSeries;

try
        {
            cn.Open();
        }
        catch (iDB2Exception ex)
        {
            HandleError("An error occurred on cn.Open()", ex);
            return;
        }
 
        //************************************************************
        // B: define stored procedure - GENERAL parameter style
        //************************************************************
        String sp = "call YourLibrary.YourProgram(@Parm1, @Parm2)";

        iDB2Command cmd;

        try
        {

 
//*************************************************************
          // C: set up command, derive parameters, set input parm values
 
//*************************************************************
          cmd = new iDB2Command(sp, cn);
          cmd.CommandType = System.Data.CommandType.Text;
          cmd.DeriveParameters();

 
//*************************************************************
          // D: Request - get value or set to default
 
//*************************************************************
          cmd.Parameters["@Parm1"].Value = 'initial Value if you need
it'; 
 
//*************************************************************
          cmd.Parameters["@Parm2"].Value = String.Empty;

          cmd.ExecuteNonQuery();
 
          String TestParm = cmd.Parameters["@Parm2"].Value.ToString();
                                 }
                   Catch
                                 {
                                                 // Do Error Stuff
                                 }

HTH

Bruce Collins

IT Architect

AAA Cooper Transportation

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.