We have a VB.NET 2005 app that uses IBM.Data.DB2.iSeries provider to connect to our DB2 server.
The connection string for the DB2 connection is set as -
"Data Source=<server>;User ID=<UID>;Password=<pwd>;ConnectionTimeout=120;"
And this is how we are updating a table in the DB2 server (using transactions) -
Expand|Select|Wrap|Line Numbers
- Dim cnDB2 as new iDB2Connection(<connString>)
- Dim TransDB2 as iDB2Transaction = nothing
- dim cmdDB2 as new iDB2Command
- cnDB2.Open
- TransDB2 = cnDB2.BeginTransaction
- with cmdDB2
- <various command object properties including
- .Connection = cnDB2
- .Transaction = TransDB2 >
- end with
- for I as integer = 0 to 5
- <set cmdDB2 parameter values>
- cmdDB2.executeNonQuery
- 'if error occurred - do rollback
- if cmdDB2.ReturnCode = 100 then
- TransDB2.Rollback
- return false
- end if
- next I
- 'if no errors, commit the entire batch
- TransDB2.Commit
- return true
- Exit Sub
Any help will be greatly appreciated. I have been stumped by this for the last 4 hours. Please help.
Thanks,
Sree