Adodc1.RecordSource = "Select * From查询,结果总是错误,得到的是第一条记录(用的是VB6.0)
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\程序\PHPList.mdb"
End Sub
Private Sub Command4_Click()
Set DataGrid1.DataSource = Adodc1
Adodc1.RecordSource = "Select * From PHP where model ='% " & Text1.Text & "% ' "
If Adodc1.Recordset.RecordCount <> 0 Then
Text2.Text = Adodc1.Recordset.Fields(4).Value
Text3.Text = "D:\程序" & Adodc1.Recordset.Fields(1) & "" & Adodc1.Recordset.Fields(4)
Else
Text2.Text = "首次"
Text3.Text = "通知工程师"
Adodc1.Refresh
End If
End Sub
Private Sub Text1_Click()
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Command4_Click
End If
End Sub
总是运行text2和test3里面是第一条记录"电信"的内容,如text1里输入A1、B1或其他任何字符,都是显示第一条A1里面的“”D程序“”和“”地址字段“”的信息
期望: text2和test3能显示查找到的与text1对应的记录
(PS:刚入门求解答)
先刷新再取数据