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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP OLE DB Can't Rlock a record From VB

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
0
0
SG
My colleague is developing a VB program to work concurrent with my current VFP program. In my program i use to use rlock() to lock a record (reserve a record,sound stupid but is user request). Now my friend want to determine or lock a vfp table record from his VB program. So i suggest he use VFP OLE DB with ADO to connect to the VFP table. After that we found out some VFP command can be execute from VB by using:
strSQL = "SYS(2003)"
oConn.Excecute (strSQL)

But when we try

strSQL = "RLOCK()"
oConn.Excute (strSQL)

It return true .but i still can access the record from VFP with rlock().and make modification on it.

My friend built the connection with code (VB code) below :
Code:
Dim Cn As ADODB.Connection
Dim strCn As String
Dim rstCn As ADODB.Recordset

strCn = "Provider=vfpoledb.1;"&
        "Data Source=C:\tmp\;" &
        "Collating Sequence=general"

Set Cn = New ADODB.Connection
Cn.Open strCn

Set rstCn = New ADODB.Recordset
rstCn.Open "AC", Cn, , , adCmdTable

strSQL = "RLOCK()"
a = n.Execute(strSQL) 'a(0) return True
 
andreateh,

What is the LOCKTYPE property of the ADO Recordset that your colleague is using. Make sure it is 2 and you can probably get rid of the need to pass RLOCK() which I've not seen before anyways.

Also, this question, while it does deal with VB is really a database related question so you might want to post similar posts in the following forum in the future:

Microsoft: VFP - Databases, SQL, and Reports Forum (5 members)
forum1252


boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
Thanks for fast reply.the LockType is already set to 2 but still not working. I still able to modify the record in VFP. In the VFP Documentation, it had mention that Rlock() is support by VFP OLE DB.. by still not working.. will try to post the post to VB to try luck..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top