IBM® Informix® Client Software Development Kit, Version 4.10

Call a stored procedure

You can use an IfxCommand object to call a stored procedure. You must set the IfxCommand object CommandType property to StoredProcedure.

The example in this topic shows how to run a stored procedure and read any results returned by the stored procedure using an IfxDataReader object.

For more information about the IfxCommand class, see IfxCommand class. For more information about calling stored procedures, see Call stored procedures.

// Add the IBM Informix namespace
using System.Data;
using IBM.Data.Informix;
// Create a connection
IfxConnection conn=new IfxConnection("Host=berry; Service=3500; 
  Server=testserver; User ID=informix; password=ifxtest; 
//Create a command object for the stored procedure
IfxCommand spCmd = new IfxCommand("testproc", conn);
// Set the CommandType property to Storedprocedure
spCmd.CommandType = CommandType.StoredProcedure
IfxDataReader testDataReader;
    testDataReader = spCmd.ExecuteReader();
catch (Exception ex)
    // Use a messagebox to show any errors
    MessageBox.Show (ex.Message);
// Close the connection

Examples exchange | Troubleshooting

To find the PDF, see Publications for the IBM Informix 12.10 family of products.
For the release notes, documentation notes, and/or machine notes, see the Release Notes page.