主题:帮我看看错在哪里?怎么改?
vb初学,在此请教,先谢谢各位大侠!
做了个窗体,如图
[img]http://img238.ph.126.net/7Q7uAxDuruz10oVjDMAOWQ==/1423981907180604577.jpg[/img]
代码如下:
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox " 请输入查询关键字 ! ", vbExclamation
End If
If Text1.Text <> "" Then
Select Case Combo1.Text
Case "商品名称"
Adodc1.RecordSource = "select * from goods where 商品名称 Like '" & "%" & Text1.Text & "%" & "'"
Case "CAS 号"
Adodc1.RecordSource = "select * from goods where CAS 号 Like '" & "%" & Text1.Text & "%" & "'"
Case ""
MsgBox "请选择查询条件 ! ", vbExclamation
End Select
End If
[color=808000]Adodc1.Refresh[/color]
DataGrid1.Refresh
End Sub
运行时显示“from子语句出错”再确定后成为:
http://img609.ph.126.net/0I0RBAt99FOuS10APvbAkg==/1651695163339552476.jpg
选择调试后,adodc1。refresh就变黄色。
在网上查过很多资料,都不行。[em21][em21]
做了个窗体,如图
[img]http://img238.ph.126.net/7Q7uAxDuruz10oVjDMAOWQ==/1423981907180604577.jpg[/img]
代码如下:
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox " 请输入查询关键字 ! ", vbExclamation
End If
If Text1.Text <> "" Then
Select Case Combo1.Text
Case "商品名称"
Adodc1.RecordSource = "select * from goods where 商品名称 Like '" & "%" & Text1.Text & "%" & "'"
Case "CAS 号"
Adodc1.RecordSource = "select * from goods where CAS 号 Like '" & "%" & Text1.Text & "%" & "'"
Case ""
MsgBox "请选择查询条件 ! ", vbExclamation
End Select
End If
[color=808000]Adodc1.Refresh[/color]
DataGrid1.Refresh
End Sub
运行时显示“from子语句出错”再确定后成为:
http://img609.ph.126.net/0I0RBAt99FOuS10APvbAkg==/1651695163339552476.jpg
选择调试后,adodc1。refresh就变黄色。
在网上查过很多资料,都不行。[em21][em21]