Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing Operator ERROR

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
Hey fellas. Here's what I'm doing and the error.

I'm checking two fields in two separate tables as follows:

Dim RS1
Set RS1 = Server.CreateObject("ADODB.Recordset")
SQLQuery = "select * from table1 where done = false and RS2('date1') => #" & date & "#" & " order by timedue, hot desc, timein"
RS1.open SQLQuery, "DSN=matte"


SQLQuery2 = "select * table2"
Dim RS2
Set RS2 = Server.CreateObject("ADODB.Recordset")
RS2.open SQLQuery2, "DSN=matte"

***************** ERROR *****************************
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'done = false and RS2('date1') => #5/2/01#'.

/site/Page.asp, line 8

***************** ERROR *****************************

"The reward of one duty done is the power to fulfill another"
<%
Jr Clown
%>
 
I think you meant to say:

SQLQuery = &quot;select * from table1 where done = false and &quot; & RS2('date1') & &quot;=> #&quot; & date & &quot;#&quot; & &quot; order by timedue, hot desc, timein&quot;


:)
 
I just noticed I left out the **** FROM **** from my 2nd record set


Dim RS1
Set RS1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
SQLQuery = &quot;Select * from mainschedule where done = false and &quot; & oRSLogin2(&quot;date1&quot;) & &quot;=> #&quot; & date & &quot;#&quot; & &quot; order by timedue, hot desc, timein&quot;
RS1.open SQLQuery, &quot;DSN=matte&quot;


SQLQuery2 = &quot;select * FROM table2&quot;
Dim RS2
Set RS2 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
RS2.open SQLQuery2, &quot;DSN=matte&quot;



I'm now getting a type mismatch on line 7 my SQLquery. I don't see it bro &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
I don't use them -- but judging from the # symbols that are around your => right side of the equation -- do you need them on the left?

Like around your oRSLogin2(&quot;date1&quot;) stuff???

just an idea --
 
I actually got rid of if done = false.
I was only concern with displaying data >= to today. Thanks again bro &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
JrClown -
just a tip for you.

I'm going to assume that you're using Access as the backend db, since you are using # as date delimiters. What I would recommend is modifying some global include file to contain

CONST DATE_DELIM = &quot;#&quot;

Then you do your SQL String as normal, only using DATE_DELIM in place of the #. I say this because if you ever need to upsize your DB to SQL Server (which hopefully your site will get popular enough that it becomes necessary :)), SQL Server uses ' instead of # for date fields. By changing the value of the CONST, you might be able to save yourself a whole lot of misery later down the road.

Just a thought for you.
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top