Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB to Informix using ODBC. Problems with Locks.

Status
Not open for further replies.

HugoLeitao

Programmer
May 28, 2001
10
PT
Hello,

I'm having a couple of troubles with the Informix ODBC driver
and I would like to know if someone know the answer

for this situation.

The environment is :
- Visual Basic Sp4
- Informix Server 7.31.UC5
- Tables have row lock defined.

The problem is about concurrency:
- I've established a connection (ODBC) to the server and
I started a transaction with the following Code:

............................................................
Begin Work;
Update Test Set ProductName = 'sugar' where ProductID = 2;
............................................................

And I didn't commit or rollback the transaction
Now, I've a small VB program with the following Code

..............................................................
' Connection
' ------------------------------------------------
Set cnn = New ADODB.Connection
cnn.ConnectionTimeout = m_intConnectionTimeOut
cnn.IsolationLevel = adXactReadCommitted
cnn.CursorLocation = ADODB.adUseClient
cnn.Open "DSN=MyDSN"

' Recordset
' ------------------------------------------------
Set rs = New ADODB.Recordset
rs.LockType = adLockBatchOptimistic
rs.CursorType = adOpenStatic

' Processes
' ------------------------------------------------
' Defining the Wait time if a concurrency lock it's found,
' which it's the case by the way.

cnn.Execute "Set Lock Mode To Wait 10 ",,adExecuteNoRecords
rs.ActiveConnection = cnn
rs.Open " Select * From Test ", , , , adCmdText
..........................................................

Problem : in the last line after the 10 seconds
I don't receive an error. Instead the recordset it's
in a normal state with BOF and EOF set to true, this
lead me to another problem. When you query the table
and the table it's empty the recordset will have the
BOF and EOF to true. So how can why distinguish

Question: Does anyone knows how to get thes error when
the record it's locked ?

I'm sorry for the extension of the post.
Tanks for further help.

Hugo Leitão.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top