读书人

sql中查询条件是变量怎样编写?该如何

发布时间: 2012-04-12 15:46:35 作者: rapoo

sql中查询条件是变量怎样编写??
Adodc1.RecordSource = "select * from 表2 where '" & Form4.Text5.Text & "' LIKE '" & Form4.Text6.Text & "%'"
其中Text5,Text6接是可以变化的文本这样写为什么查不到信息?而把'" & Form4.Text5.Text & "'改成表2中的字段就可以了

[解决办法]
Adodc1.RecordSource = "select * from 表2 where " & Form4.Text5.Text & " LIKE '" & Form4.Text6.Text & "%'"
字段名不需要单引号。

读书人网 >VB

热点推荐