Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Syntax error (missing operator) in query expression


Message #1 by "Anup Raghoebarsinf" <araghoebarsing@x...> on Fri, 7 Jun 2002 03:57:30
I'm getting the following error:

SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers WHERE Werkgeversnummer 
= AND Wachtwoord = ' ' 
Microsoft JET Database Engine error '80040e14' 

Syntax error (missing operator) in query expression 'Werkgeversnummer = 
AND Wachtwoord = ' ''. 

/mainframe/loginb2.asp, line 16 (which is: rsUser.Open strSQL)


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/connB3.asp" -->
<%
Dim strSQL
' *** Validate request to log in to this site.
  set rsUser = Server.CreateObject("ADODB.Recordset")
  rsUser.ActiveConnection = MM_connB3_STRING
Werkgeversnummer = Request.Form("Werkgeversnummer")
Wachtwoord = Request.Form("Wachtwoord")
  strSQL =  "SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers " &_
  " WHERE Werkgeversnummer = " & (Werkgeversnummer) & " AND Wachtwoord 
= ' " &(Wachtwoord)  & " ' "
  rsUser.CursorType = 0
  rsUser.CursorLocation = 2
  rsUser.LockType = 3
  Response.Write strSQL
  rsUser.Open strSQL
  If Not rsUser.EOF Or Not rsUser.BOF Then 
    ' username and password match - this is a valid user
    Session("Username") = Request.Form("Werkgeversnummer")
    rsUser.Close
    Response.Redirect("update_b3.asp")
  End If
  rsUser.Close
  Response.Redirect("inschrijf_b3.asp")
%>

<form name="LoginB" method="post" action="loginb2.asp">
<p style="margin-left: 12; margin-top: 4"><font size="2" face="Trebuchet 
MS">Gebruikersnaam</font><br>
<input type="text" name="Werkgeversnummer">
<p style="margin-left: 12; margin-top: 4"><font size="2" face="Trebuchet 
MS">Wachtwoord</font><br>
<input type="password" name="Wachtwoord">
<font face="Trebuchet MS"> 
<input type="submit" value=" Inloggen " name="Submit" class="button">
</font> </p>
</form>

Can somebody please help me with this, it's driving me mad.
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 7 Jun 2002 16:59:39 +1000
This is a multi-part message in MIME format.

------=_NextPart_000_07A8_01C20E44.B5E601B0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Anup Raghoebarsinf" <araghoebarsing@x...>
Subject: [access_asp] Syntax error (missing operator) in query 
expression


: I'm getting the following error:
:
: SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers WHERE 
Werkgeversnummer
: =3D AND Wachtwoord =3D ' '
: Microsoft JET Database Engine error '80040e14'
:
: Syntax error (missing operator) in query expression 'Werkgeversnummer 
=3D
: AND Wachtwoord =3D ' ''.
:
: /mainframe/loginb2.asp, line 16 (which is: rsUser.Open strSQL)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Look at your SQL statement:

WHERE Werkgeversnummer =3D AND Wachtwoord =3D ' '
------------------------^

You have no value here, so the database is choking on the statement.
You should *validate* your data before you stick it into an SQL 
statement!

Cheers
Ken


Message #3 by "Anup Raghoebarsinf" <araghoebarsing@x...> on Fri, 7 Jun 2002 13:39:51
Look at your SQL statement:

WHERE Werkgeversnummer =3D AND Wachtwoord =3D ' '
------------------------^

You have no value here, so the database is choking on the statement.
You should *validate* your data before you stick it into an SQL 
statement!

Cheers
Ken

I don't understand why i'm getting this error. Werkgeversnummer and 
Wachtwoord are empty but they should get the value entered in the form.

  strWerkgeversnummer = Request.Form("Werkgeversnummer")
  strWachtwoord = Request.Form("Wachtwoord")
  strSQL =  "SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers " &_
  " WHERE Werkgeversnummer = " & strWerkgeversnummer & " AND Wachtwoord 
= ' " & strWachtwoord  & " ' "
Message #4 by "Thomas, Dean" <Dean.Thomas@u...> on Fri, 07 Jun 2002 11:22:02 -0400
It looks like you missed the quotes around "strWerkgeversnummer". Also, you
may have some extra spaces in the code that aren't needed i.e. ...woord  & "
' " versus ...woord & "'"
All for now.
Dean  

-----Original Message-----
From: Anup Raghoebarsinf [mailto:araghoebarsing@x...]
Sent: Friday, June 07, 2002 9:40 AM
To: Access ASP
Subject: [access_asp] Re: Syntax error (missing operator) in query
expression


Look at your SQL statement:

WHERE Werkgeversnummer =3D AND Wachtwoord =3D ' '
------------------------^

You have no value here, so the database is choking on the statement.
You should *validate* your data before you stick it into an SQL 
statement!

Cheers
Ken

I don't understand why i'm getting this error. Werkgeversnummer and 
Wachtwoord are empty but they should get the value entered in the form.

  strWerkgeversnummer = Request.Form("Werkgeversnummer")
  strWachtwoord = Request.Form("Wachtwoord")
  strSQL =  "SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers " &_
  " WHERE Werkgeversnummer = " & strWerkgeversnummer & " AND Wachtwoord 
= ' " & strWachtwoord  & " ' "
Message #5 by "Ken Schaefer" <ken@a...> on Tue, 11 Jun 2002 13:49:22 +1000
Then you need to check:
a) that your form was correctly constructed on the previous page (eg check
for valid HTML using validator.w3.org, check that the field elements were
named correctly)
b) that your ASP code grabs the correct data from the Request.Form or
Request.QueryString collection (eg check for typos etc)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Anup Raghoebarsinf" <araghoebarsing@x...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, June 07, 2002 1:39 PM
Subject: [access_asp] Re: Syntax error (missing operator) in query
expression


: Look at your SQL statement:
:
: WHERE Werkgeversnummer =3D AND Wachtwoord =3D ' '
: ------------------------^
:
: You have no value here, so the database is choking on the statement.
: You should *validate* your data before you stick it into an SQL 
: statement!
:
: Cheers
: Ken
:
: I don't understand why i'm getting this error. Werkgeversnummer and
: Wachtwoord are empty but they should get the value entered in the form.
:
:   strWerkgeversnummer = Request.Form("Werkgeversnummer")
:   strWachtwoord = Request.Form("Wachtwoord")
:   strSQL =  "SELECT Werkgeversnummer, Wachtwoord FROM Werkgevers " &_
:   " WHERE Werkgeversnummer = " & strWerkgeversnummer & " AND Wachtwoord
: = ' " & strWachtwoord  & " ' "


  Return to Index