Link to home
Start Free TrialLog in
Avatar of sudhirchowdary
sudhirchowdary

asked on

ADO Recordset Lock Type in C++

hi all..

i am select one record from one table by opening a recordset using ADO (C++) as

m_pApprRecordSet->Open(sCommand,                          m_vConnection,
                 adOpenStatic,
                 adLockPessimistic,
                 adCmdText);

while this recordset is open, i want to restrict (should not allow read access also) other application to access this record (literally this record should become un-visible) untill i update that record, commit the transaction and close that recordset.

for this i am using ADO's "adLockPessimistic" as lock type while opening the recordset. but what i found is that, while my recordset is open, this record is still visible to other apps and they are able to read the values from this record...

can anyone have ideas...

(i have asked a related question about record level locking in Oracle section also)

thanx

Avatar of ambience
ambience
Flag of Pakistan image

I think of using BeginTrans and using the isolationlevel property to achieve the required results.

I wonder if setting iso-level to adXactIsolated could make the DBMS hold exclusive access lock on the record under-question , but i think this may help

correct me if am wrong
Avatar of sudhirchowdary
sudhirchowdary

ASKER

hi ambience

the isolation level property is of no help for this situation...

thanx
Somehow i thought that specifying the highest level of isolation level for a transaction causes the DBMS to hold exclusive lock on the records and no read or write can be done against it , this was the only way i thought of, maybe that is not applicable to you..

i'll try to find out some other ways if possible :)
hi ambience
i am looking at the possibilty of using isolation preperty, but i couldn't find any detailed explanation about how it works...do you have any links where i can find more info about using that

thanks a lot for the ideas..i appreciate it

hi all
i have a question for if you are familair with ADO locks...does the adLockPessimistic is supposed to lock read access?

thanks

Sudhir
hi ambience
i am looking at the possibilty of using isolation preperty, but i couldn't find any detailed explanation about how it works...do you have any links where i can find more info about using that

thanks a lot for the ideas..i appreciate it

hi all
i have a question for if you are familair with ADO locks...does the adLockPessimistic is supposed to lock read access?

thanks

Sudhir
hi agian...
i guess adLockPessimistic in ADO avoids other applications from reading the record which is locked. i am trying this in C++ ( with COM) in MTS transaction...
can any one tell me if i need to assign any other properties or cursor typs etc...to use this.

Sudhir
hi agian...
i guess adLockPessimistic in ADO avoids other applications from reading the record which is locked. i am trying this in C++ ( with COM) in MTS transaction...
can any one tell me if i need to assign any other properties or cursor typs etc...to use this.

Sudhir
hi agian...
i guess adLockPessimistic in ADO avoids other applications from reading the record which is locked. i am trying this in C++ ( with COM) in MTS transaction...
can any one tell me if i need to assign any other properties or cursor typs etc...to use this.

Sudhir
hi agian...
i guess adLockPessimistic in ADO avoids other applications from reading the record which is locked. i am trying this in C++ ( with COM) in MTS transaction...
can any one tell me if i need to assign any other properties or cursor typs etc...to use this.

Sudhir
ASKER CERTIFIED SOLUTION
Avatar of ambience
ambience
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi ambience,

i am using adUseClient cursor type...so i guess i need to change it to adUseServer...thanks for the comment..i will try this and get back to you..

this issue is bothering me as my deadline is nearing

thanks a lot
hi ambience,

i am using adUseClient cursor type...so i guess i need to change it to adUseServer...thanks for the comment..i will try this and get back to you..

this issue is bothering me as my deadline is nearing

thanks a lot
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "ambience" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner

Answer accepted by:

ComTech
CS @ EE