VB 实时错误‘3705’ 对象打开时,不允许操作,怎样解决,求大神
代码是这样的DimrstAsNewADODB.RecordsetDimsqlAsStringDimconnAsNewADODB.ConnectionPrivateSubC...
代码是这样的
Dim rst As New ADODB.Recordset
Dim sql As String
Dim conn As New ADODB.Connection
Private Sub Command1_Click()
conn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\stu.mdb" conn.Open
If conn.State = adStateOpen Then
Print "ok"
End If
sql = "select * from stu"
rst.CursorLocation = adUseClient
rst.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rst
End Sub
点一次按钮可以,点第二次就出现这种情况 展开
Dim rst As New ADODB.Recordset
Dim sql As String
Dim conn As New ADODB.Connection
Private Sub Command1_Click()
conn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\stu.mdb" conn.Open
If conn.State = adStateOpen Then
Print "ok"
End If
sql = "select * from stu"
rst.CursorLocation = adUseClient
rst.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rst
End Sub
点一次按钮可以,点第二次就出现这种情况 展开
展开全部
Dim rst As New ADODB.Recordset
Dim sql As String
Dim conn As New ADODB.Connection
Private Sub Command1_Click()
If conn.State = adStateOpen Then conn.close
conn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\stu.mdb"
conn.Open
sql = "select * from stu"
rst.CursorLocation = adUseClient
if rst.state=1 then rst.close
rst.Open sql, conn, adOpenKeyset, adLockPessimistic
Set DataGrid1.DataSource = rst
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询