Can someone help me with updating a VFP 6 table using ADO please? This is the code I'm using at present and it appears to returns a Read-only recordset? Also is there a way to limit no of records to return as my Select seems take quite some time for larger table?
Thanks
NW
Private Sub Form_Load()
Dim strCnn As String
strCnn = "SourceType=DBF; " & _
"SourceDB=y:\customer\sarm\;" & _
"Driver={Microsoft Visual FoxPro Driver}"
Set cn = New ADODB.Connection
cn.Open strCnn
End Sub
Private Sub cmdUpdate_Click()
Dim strSQL as String
Dim rs As New ADODB.Recordset
strSQL = "SELECT * FROM C:\test where Trim(Field1)='" & Trim(Text1.Text) & "'"
rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
rs.Fields("Field2"
.Value = "NEW Value"
rs.Update
Else
MsgBox "No records returned!"
Endif
End Sub
Thanks
NW
Private Sub Form_Load()
Dim strCnn As String
strCnn = "SourceType=DBF; " & _
"SourceDB=y:\customer\sarm\;" & _
"Driver={Microsoft Visual FoxPro Driver}"
Set cn = New ADODB.Connection
cn.Open strCnn
End Sub
Private Sub cmdUpdate_Click()
Dim strSQL as String
Dim rs As New ADODB.Recordset
strSQL = "SELECT * FROM C:\test where Trim(Field1)='" & Trim(Text1.Text) & "'"
rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
rs.Fields("Field2"
rs.Update
Else
MsgBox "No records returned!"
Endif
End Sub