vb中select 查询语句 from子句错误

来源:百度知道 编辑:UC知道 时间:2024/06/05 16:22:12
我就郁闷了,在用sql语句做查询时,完成不了。 程序弹出from子句语法错误。(adodb1显示对话框)。
本人新手,不会改。烦劳各位大侠帮忙解决!!

If Combo2.Text = "like" Then
Ado_1.RecordSource = "select * from mmethod where mmethod." & Combo1.Text & " like + '%" + Text5.Text + "%'"
Ado_1.Refresh
Else
Ado_1.RecordSource = "select * from mmethod where mmethod." & Combo1.Text & Combo2 & " + '" + Text5.Text + "'"
Ado_1.Refresh
End If
其中用了"like"模糊查询。上述语句ado_1没有换行。mmethod指的是access2000中建立的表。

Ado_1.RecordSource = "select * from mmethod where mmethod." & Combo1.Text & " like '%" + Text5.Text + "%'"
这样改看行不行,如果行把分给我啊 我可是第一个回答的哦 呵呵

楼上的貌似才是对的
楼主在like里面多了个+了

Ado_1.RecordSource = "select * from mmethod where mmethod." & Combo1.Text & " like + '%" & Text5.Text & "%'"

Ado_1.RecordSource = "select * from mmethod where mmethod." & Combo1.Text & " like '" & "%" & Text5.Text & "%" & "'"
Ado_1.Refresh