我想用单引号
来区分值将usr称为字符串
usr = "01,AF,BF,CD,DF,FE,"
我想将此字符串传递给sql查询
Sql Query
Select * from table1 where code in ('" & usr & "')
输出什么都没有显示,bcoz在sql中传递字符串是不正确的
Sql不会理解'01,AF,BF,CD,DF,FE,'而不是这个,我们需要通过 像这样的字符串
user = 'AF', 'BF', 'CD', 'FE'
如何做到这一点。
需要vb6代码帮助
答案 0 :(得分:3)
我就是这样做的:
usr = Replace(Left(usr, Len(usr) - 1), ",", "','")
sql = "Select * from table1 where code in ('" & usr & "')"
答案 1 :(得分:0)
arr = split(usr, ",")
usr = join(arr,"','")
修剪双引号并用单引号替换