vb中使用sql语句查询时 条件可以用变量么

例如 我用个语句select * from 表1 where 名字叫=' ??` 这里的问号条件可以想办法用程序里设置的变量代替么??比如设置个dim a as string 用a来代替

Dim tj As String
Dim strSql As String
tj = "卡洛修斯"
strSql = "Select * from 表1 where 名字叫='" & tj & "'"
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答