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!

VFP OLE DB Can't Rlock a record From VB

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
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

even though i set the ADO recordset LOCKTYPE = 2 but it still not working.Please somebody help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top