VB Refresh的方法IAdodc失败
Private Sub Command1_Click()
If Text1 > "" Then
Adodc1.RecordSource = "select * from student where num= '" & Text1 & "'"
End If
Adodc1.Refresh
End Sub
[解决办法]
adodc1控件没有与数据库连接吧
[解决办法]
Adodc1.RecordSource = "select * from student where num= '" & Text1.text & "'"
text1.text是什么?
你再试一下
Adodc1.RecordSource = "select * from student where num= " & Text1.text &
[解决办法]
RecordSource改变后Adodc要关闭再重新打开才可以
[解决办法]
Private Sub Command1_Click()
Adodc1.connection="provider=.................." '连接加了没啊
If Text1 <> "" Then
Adodc1.RecordSource = "select * from student where num= '" & Text1 & "'"
End If
Adodc1.Refresh
End Sub
[解决办法]
你最好再定义个变量S1
s1 = "select * from student where num= '" & Text1.text & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = s1
Adodc1.Refresh
这样你再试试看
这个问题我也曾搞了半天
[解决办法]
或者你把
Adodc1.CommandType = adCmdText
加在
Adodc1.RecordSource = "select * from student where num= '" & Text1.txt & "'"
前试试
应该可以解决