PDA

Click to See Complete Forum and Search --> : 'Join' condition


Tonatiuh
Sep 23rd, 1999, 07:39 AM
I have problems to update recordset extracted from a Visual FoxPro involving a 'join' condition.

Every thing works well in a recordset from a simple single table.

I'm using ADO in VB5.

Option Explicit

Public cn As ADODB.Connection
Public rs As ADODB.Recordset
Public SQL As String

Private Sub Form_Load()
Set cn = New Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = "DSN=Prueba;UID=;PWD=;OLE DB Services=-1;"
cn.Open
cn.CursorLocation = adUseClient
SQL = "SELECT t1.* FROM t1,t2 WHERE t1.ncontra = t2.ncontra AND t2.usuario = 'JMESCO'"
rs.Open SQL, cn, dOpenKeyset, dLockOptimistic, -1
rs.MoveFirst
Text1.Text = rs!ncontra
Text2.Text = rs!Desc
Text3.Text = rs!Number
End Sub

Private Sub Command1_Click()
rs!ncontra = Text1.Text
rs!Desc = Text2.Text
rs!Number = Val(Text3.Text)
rs.Update
End Sub

Thanks!

If you want to reproduce the problem, I can send you the database (is very short).

[This message has been edited by Tonatiuh (edited 09-23-1999).]