Hi to all master, i'm new in vb6 programming and i'm creating a simple server/client connection which saves and delete a record.
upon clicking the save button i always get an error of OPERATION MUST USE AN UPDATEABLE QUERY on the line .update
any idea would be much appreciated. thanks in advance.
upon clicking the save button i always get an error of OPERATION MUST USE AN UPDATEABLE QUERY on the line .update
Code:
=====================
@client side
=====================
Option Explicit
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim MSDatabase As String
Private Sub cmdConnect_Click()
scket.RemoteHost = "192.168.0.116"
scket.RemotePort = 2468
scket.Connect
MSDatabase = "\\192.168.0.116\mydata\vansdb.mdb"
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Mode = adModeReadWrite
cn.Open MSDatabase, "Admin"
MsgBox "Database connected"
End Sub
Private Sub cmdSave_Click()
Set rs = New ADODB.Recordset
rs.Open "select * from tblinfo", cn, adOpenKeyset, adLockPessimistic
With rs
.AddNew
.Fields("fname") = txtFname.Text
.Fields("lname") = txtLname.Text
.Update
End With
MsgBox "new data has been saved!"
End Sub
=====================
@server side
=====================
Option Explicit
Dim iNDX As Integer
Private Sub cmdClose_Click()
scket(0).Close
Unload Me
End Sub
Private Sub Form_Load()
scket(0).Close
scket(0).LocalPort = 2468
scket(0).Listen
sLog Format(Now, "hh:mm:ss am/pm") & " Listening"
End Sub
Private Sub sLog(ByVal Text As String)
txtLog.Text = txtLog.Text & Text & vbNewLine
txtLog.SelStart = Len(txtLog)
End Sub
Private Sub scket_ConnectionRequest(Index As Integer, ByVal requestID As Long)
iNDX = iNDX + 1
Load scket(iNDX)
scket(iNDX).Accept requestID
sLog Format(Now, "hh:mm:ss am/pm") & " Connected " & "Request ID: " & requestID _
& " Socket Handler " & scket(0).SocketHandle
End Sub