Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Syntax error (missing operator) in query expression

New Here ,
Oct 28, 2009 Oct 28, 2009

Hello all,

I have two pages, one page inserts and passes variables to the other page. The other page, (troublesome page) I have the following code:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connNewdatabase.asp" -->
<%
Dim svuserid
svuserid = "0"
if (Session("UserID") <> "") then svuserid = Session("UserID")
%>
<%
set rsClients = Server.CreateObject("ADODB.Recordset")
rsClients.ActiveConnection = MM_connNewdatabase_STRING
rsClients.Source = "SELECT *  FROM CLIENTSW WHERE CASENUM="& Replace(svuserid, "'", "''") & "Order by Casenum"
rsClients.CursorType = 0
rsClients.CursorLocation = 2
rsClients.LockType = 3
rsClients.Open()
rsClients_numRows = 0
%>

My insert page inserts correctly, but when I get to the second page I get the following error:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'CASENUM=09E-1006721Order by Casenum'.

/done3.asp, line 16

I can see by this statement that my variable, svuserid, is being passed correctly as the previous page inserted 09E-1006721 as the casenum. It is being stored in a field called casenum, it is of text type. I believe the problem is the "Order by Casenum". If I take the "Order By Casenum" out I get:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/done3.asp, line 34

How do you write the select statement above to read select everything out of clientsw where the casenum = svuserid, order by field casenum if the field casenum is a text field? I am probably missing something simple, but its got me stumped.

TOPICS
Server side applications
571
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2009 Oct 28, 2009

Disregard this post please.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 29, 2009 Oct 29, 2009
LATEST

Marking this thread as assumed answered.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines