请教变量在SQL里的用法
为什么 我使用
dim XDBH as string
SQL = "select * from 资料 where ID = " & XDBH & "" 可以成功连接数据库
而使用
Public OnID As String
dim XDBH as string
OnID = " where ID = " & XDBH & ""
SQL = "select * from 资料 " & OnID
就失败,显示 " where ID = " 错误
[解决办法]
SQL = "select * from 资料 "
OnID = " where ID = " & XDBH & ""
sql=sql & OnID