vb 运行时错误'3709',连接无法用于些操作
PrivateSubCommand1_Click()DimCnnAsNewADODB.ConnectionDimrsAsNewADODB.RecordsetCnn.Con...
Private Sub Command1_Click()
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\leehl.mdb;Mode=ReadWrite;Persist Security Info=False;"
Cnn.Open
rs.CursorLocation = adUseClient
rs.Source = "select 姓名 from xuesheng where 号码='" & Text1.Text & "' "
rs.Open
Text2.Text = rs.Fields("姓名")
End Sub
运行时老提示"运行时错误'3709',连接无法用于此操作"请大哥们帮我看看哪里错了,不胜感激啊
我是想以text1.text的值为"号码"字段相应的值作为搜索条件,得出相应"姓名"字段的值显示在text2.text上.
对不起,有点表达不出来,呵呵,差不我这个意思啦 展开
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\leehl.mdb;Mode=ReadWrite;Persist Security Info=False;"
Cnn.Open
rs.CursorLocation = adUseClient
rs.Source = "select 姓名 from xuesheng where 号码='" & Text1.Text & "' "
rs.Open
Text2.Text = rs.Fields("姓名")
End Sub
运行时老提示"运行时错误'3709',连接无法用于此操作"请大哥们帮我看看哪里错了,不胜感激啊
我是想以text1.text的值为"号码"字段相应的值作为搜索条件,得出相应"姓名"字段的值显示在text2.text上.
对不起,有点表达不出来,呵呵,差不我这个意思啦 展开
1个回答
展开全部
Private Sub Command1_Click()
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=leehl.mdb;Mode=ReadWrite;Persist Security Info=False;"
Cnn.Open
rs.CursorLocation = adUseClient
rs.Source = "Select * from xuesheng "
rs.open sql,cnn,1,3
Text2.Text = rs("姓名")
End Sub
这样就可以了!
记得加分
Dim Cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=leehl.mdb;Mode=ReadWrite;Persist Security Info=False;"
Cnn.Open
rs.CursorLocation = adUseClient
rs.Source = "Select * from xuesheng "
rs.open sql,cnn,1,3
Text2.Text = rs("姓名")
End Sub
这样就可以了!
记得加分
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询