Very strange iSeries Provider behavior

Posted by AJ on Stack Overflow See other posts from Stack Overflow or by AJ
Published on 2010-04-22T15:09:18Z Indexed on 2010/04/22 15:13 UTC
Read the original article Hit count: 736

Filed under:
|
|
|

We've been given a "stored procedure" from our RPG folks that returns six data tables. Attempting to call it from .NET (C#, 3.5) using the iSeries Provider for .NET (tried using both V5R4 and V6R1), we are seeing different results based on how we call the stored proc. Here's way that we'd prefer to do it:

using (var dbConnection = new iDB2Connection("connectionString"))
{
    dbConnection.Open();
    using(var cmd = dbConnection.CreateCommand())
    {
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "StoredProcName";
        cmd.Parameters.Add(new iDB2Parameter("InParm1", 
            iDB2DbType.Varchar).Value = thing;
        var ds = new DataSet();
        var da = new iDB2DataAdapter(cmd);
        da.Fill(ds);
    }
}

Doing it this way, we get FIVE tables back in the result set. However, if we do this:

cmd.CommandType = CommandType.Text;
cmd.CommandText = "CALL StoredProcName('" + thing + "')";

We get back the expected SIX tables.

I realize that there aren't many of us sorry .NET-to-DB2 folks out here, but I'm hoping someone has seen this before.

TIA.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET