Unix Technical Forum

ODBC Net driver throw an exception

This is a discussion on ODBC Net driver throw an exception within the DB2 forums, part of the Database Server Software category; --> Does anyone have problem of running stored procedure from VB .NET using the ODBC driver, The OleDB driver work ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 06:57 PM
Tony Do
 
Posts: n/a
Default ODBC Net driver throw an exception

Does anyone have problem of running stored procedure from VB .NET using the
ODBC driver, The OleDB driver work OK with the same Stored Procedure, also
the ASP work OK with that same Stored Procedure.

Here is the VB .NET Code

Dim constr as String =
"DSN=UPLUS;UID=db2admin;PWD=office;MODE=SHARE;DBAL IAS=UPLUS;PATCH2=6;PATCH1=
1024;LOBMAXCOLUMNSIZE=1048575;LONGDATACOMPAT=1;"
Dim OConnection as New System.Data.ODBC.ODBCConnection(constr)
Dim OCommand As New System.Data.ODBC.ODBCCommand("InsertAreturn10",
OConnection)
OCommand.CommandType = CommandType.StoredProcedure
OConnection.open()
OCommand.ExecuteNonQuery()
OConnection.close()

Produce the error
ERROR [42601] [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token
"END-OF-STATEMENT" was found following "InsertAreturn10". Expected tokens
may include: "JOIN <joined_table>". SQLSTATE=42601
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.Odbc.OdbcException: ERROR [42601] [IBM][CLI
Driver][DB2/NT] SQL0104N An unexpected token "END-OF-STATEMENT" was found
following "InsertAreturn10". Expected tokens may include: "JOIN
<joined_table>". SQLSTATE=42601


Where as the following code (OleDB driver) run fine

Dim constr as String ="Provider=IBMDADB2.1;Password=office;Persist Security
Info=True;User ID=db2admin;Data Source=UPLUS"
Dim OConnection as New System.Data.OleDb.OleDbConnection(constr)
Dim OCommand As New System.Data.OleDB.OleDbCommand("InsertAreturn10",
OConnection)
OCommand.CommandType = CommandType.StoredProcedure
OConnection.open()
OCommand.ExecuteNonQuery()
OConnection.close()


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:01 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com