如何使用visual basic 6.0修复此sql语法错误?

时间:2014-04-10 12:49:43

标签: sql vb.net

我在此SQL查询中收到语法错误。

s2 = "select * from Seats where train name like '" & trains.lbl4.Caption & "' and train no like " & trains.lbl3.Caption

请帮我识别语法错误

1 个答案:

答案 0 :(得分:0)

select * from Seats where [train name] like '" & trains.lbl4.Caption & "%' and [train no] like '" & trains.lbl3.Caption & "%'"

这应该做到

如果您有匹配的确切值,请使用此select语句:

select * from Seats where [train name] ='" & trains.lbl4.Caption & "' and [train no] = '" & trains.lbl3.Caption & "'"