问题
error:
In operator without () in query expression '(EnrollmentsTbl.UserName LIKE ? IN '' [;DATABASE=e:\web\mcfrsitcom0\htdocs\trackingHIPAA\App_Data\subsite.mdb])'.
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.
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?
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])"
回答1:
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" & _
")"
I just tried a similar query in C# using OleDb and it worked fine.
回答2:
The IN
operator looks for values that exist in a static list of values or the results of a subquery. You seem to be using it to find values in a database file.
You also combine it with the LIKE
operator which doesn't make sense.
Perhaps if you explained better what you're trying to do an alternative could be found.
来源:https://stackoverflow.com/questions/22698305/in-operator-without-in-query-expression