[Mono-list] StoredProcedure Output Parameters System.Data.Odbc

Bartolomeo Nicolotti bnicolotti at siapcn.it
Fri Feb 13 09:43:04 EST 2009


Hi,

I'm trying unixodbc with System.Data.ODBC to access DB2 for iseries

I can do select, see this file 
http://www.nabble.com/file/p21997635/helloODBC.cs helloODBC.cs , but I've
some problems with out parameters of stored procedueres.

With this file  http://www.nabble.com/file/p21997635/helloODBCCommand.cs
helloODBCCommand.cs  I get:

Hello, Dunkel
Eseguo:CALL QGPL.WBC022(9)
Eseguo:CALL GIANLUCA.PROVACS
System.Data.Odbc.OdbcException: ERROR [42000] [unixODBC][IBM][iSeries Access
ODBC Driver][DB2 UDB]SQL0104 - Token GIANLUCA non valido. Token validi: (
END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER.


It seems that setting the CommandType to StoredProcedure has no effect, as
one can also see from the source of mono (I've installed mono from source)

/home/siap/dwn/src/mono/mono-2.2/mcs/class/System.Data/System.Data.Odbc/OdbcCommand

the ExecuteNonQuery member function call ExecSQL that


private int ExecuteNonQuery (bool freeHandle)
                {
...
                        ExecSQL(CommandText);

ExecSQL is:

                private void ExecSQL (string sql)
                {
                        OdbcReturn ret;
                        if (! prepared && Parameters.Count <= 0) {

                                ReAllocStatment ();
                               
                                ret = libodbc.SQLExecDirect (hstmt, sql,
libodbc.SQL_NTS);
                                if ((ret != OdbcReturn.Success) && (ret !=
OdbcReturn.SuccessWithInfo) &&
                                    (ret != OdbcReturn.NoData))
                                        throw connection.CreateOdbcException
(OdbcHandleType.Stmt, hstmt);
                                return;
                        }

                        if (!prepared)
                                Prepare();

                        BindParameters ();
                        ret = libodbc.SQLExecute (hstmt);
                        if (ret != OdbcReturn.Success && ret !=
OdbcReturn.SuccessWithInfo)
                                throw connection.CreateOdbcException
(OdbcHandleType.Stmt, hstmt);
                }

Should I use prepared to BindParameters?

How can I get the output parameter of a Stored Procedure?

Many thanks

Best regards
-- 
View this message in context: http://www.nabble.com/StoredProcedure-Output-Parameters-System.Data.Odbc-tp21997635p21997635.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list