Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO with vfpoledb unlocking records
Message
 
To
08/07/2005 21:05:52
Maltin Lacsina
Angeles Electric Corporation
Angeles, Philippines
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01029309
Message ID:
01030864
Views:
13
Create an ADODB.Recordset and then use it's open method... the 5 optional parameters you can send to the open method are (see #4 for your locking)...

1. The Source (in your case an SQL Statement

2. A connection string or connection object (oCon)

3. The Cursor Type (I'll provide the defines for you for you so you can translate code you find on the net while searching and messing with this stuff)
#DEFINE adOpenUnspecified -1
#DEFINE adOpenForwardOnly 0
#DEFINE adOpenKeyset 1 && probably this one, but only you will know based on the info you've provided so far
#DEFINE adOpenDynamic 2
#DEFINE adOpenStatic 3

4. Locking Type (this is what you're interested in)
#DEFINE adLockUnspecified -1
#DEFINE adLockReadOnly 1
#DEFINE adLockPessimistic 2 && this is the one you'll probably want based on what I read
#DEFINE adLockOptimistic 3
#DEFINE adLockBatchOptimistic 4

5. How #1 should be evaluated when it's not a command object
#DEFINE adCmdUnspecified -1
#DEFINE adCmdText 1 && this is the one you'll want
#DEFINE adCmdTable 2
#DEFINE adCmdStoredProc 4
#DEFINE adCmdUnknown 8 && this is the Default
#DEFINE adCmdFile 256
#DEFINE adCmdTableDirect 512


When you're done updating the fields in your record call...

rs.Update() &&to unlock the record

...there are other ways of doing this. you could build the rs object up by creating it and then setting it's properties (such as it's LockType property), but I think this should be enough to get you going.


>Well I can lock the record in ADO with VFPOLEDB like this
>oRS = oCon.Execute("Select RLock() From MyTable Where Code='001'")
>But I dont know how the syntax for unlocking the record.
>
>Thanks any way I guess Ill have to look further about this.
Previous
Reply
Map
View

Click here to load this message in the networking platform