本文介绍了在查询表达式中不带()的运算符中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:

描述:在执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.Data.OleDb.OleDbException:在运算符中不带()的查询表达式'(EnrollmentsTbl.UserName LIKE?IN''[; DATABASE = e:\ web \ mcfrsitcom0 \ htdocs \ trackingHIPAA \ App_Data \ subsite .mdb])".

Exception Details: System.Data.OleDb.OleDbException: In operator without () in query expression '(EnrollmentsTbl.UserName LIKE ? IN '' [;DATABASE=e:\web\mcfrsitcom0\htdocs\trackingHIPAA\App_Data\subsite.mdb])'.

不确定为什么要在其他位置请求()?

not sure why is asking for () in different place?

这是ASPX vb.net中的SELECT

here is SELECT in ASPX vb.net

 SelectCommand="SELECT EnrollmentsTbl.AutoNum, EnrollmentsTbl.UserName, EnrollmentsTbl.SubmitTime, EnrollmentsTbl.ClassName, EnrollmentsTbl.ClassDate, EnrollmentsTbl.ClassTime, EnrollmentsTbl.Enrolled, EnrollmentsTbl.WaitListed, EnrollmentsTbl.Instructor, EnrollmentsTbl.DateCompleted, EnrollmentsTbl.Completed, EnrollmentsTbl.Walkin FROM EnrollmentsTbl WHERE (EnrollmentsTbl.UserName LIKE ? IN '' [;DATABASE=e:\web\mcfrsitcom0\htdocs\trackingHIPAA\App_Data\subsite.mdb])" 

推荐答案

从您的其他评论看来,您想要做更多这样的事情:

From your other comments it sounds like you want to do something more like this:

SelectCommand = _
        "SELECT EnrollmentsTbl.AutoNum, EnrollmentsTbl.UserName, EnrollmentsTbl.SubmitTime, " & _
            "EnrollmentsTbl.ClassName, EnrollmentsTbl.ClassDate, EnrollmentsTbl.ClassTime, " & _
            "EnrollmentsTbl.Enrolled, EnrollmentsTbl.WaitListed, EnrollmentsTbl.Instructor, " & _
            "EnrollmentsTbl.DateCompleted, EnrollmentsTbl.Completed, EnrollmentsTbl.Walkin " & _
        "FROM EnrollmentsTbl " & _
        "WHERE EnrollmentsTbl.UserName IN " & _
            "(" & _
                "SELECT OtherColumnName " & _
                "FROM [;DATABASE=e:\web\mcfrsitcom0\htdocs\trackingHIPAA\App_Data\subsite.mdb].OtherTableName" & _
            ")" 

我刚刚使用OleDb在C#中尝试了类似的查询,并且效果很好.

I just tried a similar query in C# using OleDb and it worked fine.

这篇关于在查询表达式中不带()的运算符中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 02:26