VB6.0连接数据库问题,运行错误3709。

Public Sub updata()
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS , cnn, adOpenKeyset, adLockOptimistic"
(调试显示上面这个位置出错3709)
re.MoveFirst
Do While Not rs.EOF
X11 = rs.Fields("X1")
Y11 = rs.Fields("Y1")
lx = rs.Fields("TYPE")
Select Case lx
Case 1
Call byq(X11, Y11, 1, 1, False)
Case 2
Call dy(X11, Y11, 1, False)
End Select
Loop
rs.Close
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim x1 As Integer
Dim x2 As Integer
Dim y1 As Integer
Dim y2 As Integer
If moveflag = ture Then
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
x1 = x2: y1 = y2
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS ", cnn, adOpenKeyset, adLockOptimistic
xnow = rs.Fields("X1")
ynow = rs.Fields("Y1")
rs.Fields("X1") = xnow + x2 - x1
rs.Fields("Y1") = ynow + y2 - y1
x2 = X: y2 = Y
rs.Update
rs.Close
Picture1.Cls
Call updata
End If

End Sub

1个回答

用以下语句试试。

rs.Open "select * from YJCS" , cnn, adOpenKeyset, adLockOptimistic

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问