【问题标题】:I have a error with my query [closed]我的查询有错误[关闭]
【发布时间】:2015-12-22 03:21:19
【问题描述】:
sql = "select * from studentlist where firstname like '%" & Transaction.SEARCHSTUDENT.Text & "%' or studentnum like '%" & Transaction.SEARCHSTUDENT.Text & "%' exists(select * from studentlist where status = 'Vacant')"

请帮我解决我的查询

【问题讨论】:

  • 错误是什么?你试过手动执行吗?

标签: sql vb.net


【解决方案1】:

请考虑使用参数绑定,而不是直接在 SQL 字符串中连接参数。

也就是说,你有一个错字:

"%' exists(...

应该是(注意缺少and):

"%' and exists(

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-07
    • 2013-03-02
    • 2022-01-24
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多