连接无法用于执行此操作。在此上下文中它可能已被关闭或无效
Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Command4_Click()
Set conn = New ADODB.Connection strq = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\restaurant.mdb" conn.CommandTimeout = 30 conn.Open strq
Set rs = New ADODB.Recordset If Text1.Text = "" Then MsgBox "姓名不能为空!", 48, "提示" Exit Sub End If If Text2.Text = "" Then MsgBox "证件号不能为空!", 48, "提示" Exit Sub End If rs.Open "一个insert语句",conn 运行时提示“连接无法用于执行此操作。在此上下文中它可能已被关闭或无效”。连接字符串是自动生成的,就是打不开,请问这是怎么回事?谢谢大家拉