By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,589 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,589 IT Pros & Developers. It's quick & easy.

Using Transactions to Insert Data to Db2 Database

P: n/a
Hi All

I am trying to insert data within a transaction, into a Db2 database
from asp.net.

I have created a System DSN using ISeries Access Driver(32 bit) for
Windows. I am then connecting to it using Microsoft .Net data provider
from asp.net.

I am able to insert data by using connection and comand object without
the transaction.

But the PROBLEM comes when i try to put the INSERT query execution
within a Transaction.
Like the following
cnOdbc = New OdbcConnection("DSN=TEST;UID=ABCD;PWD=1234")
cnOdbc.Open()
cmdOdbc.Connection = cnOdbc
tranODBC = cnOdbc.BeginTransaction(IsolationLevel.ReadCommitt ed)
cmdOdbc.Transaction = tranODBC
TRY
strSql = "Insert INTO LIBRARYNAME.TABLENAME
VALUES('Z','6789','TAPSING')"
cmdOdbc.CommandText = strSql
cmdOdbc.ExecuteNonQuery() ''ERROR OCCURS ON THIS LINE''
tranODBC.Commit
Catch ex as Exception
tranODBC.RollBack
Finally
tranODBC.close

ERROR returned is
"ERROR [HY000] [IBM][iSeries Access ODBC Driver][DB2 UDB]SQL7008 -
<TableName> in <LibraryName> not valid for operation."

I will highly appreciate any help on the issue.

Vaibhav
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.