Query Question

Results 1 to 2 of 2

Thread: Query Question

  1. #1
    Join Date
    Dec 1969

    Default Query Question

    SQL = "SELECT * FROM tbl_Login WHERE UserName = &#039;" & Request.Form("UserName") & "&#039; AND Password = &#039;" & Request.Form("Password") "&#039;"<BR><BR>Generates the error:<BR>Microsoft VBScript compilation error &#039;800a0401&#039; <BR><BR>Expected end of statement <BR><BR>I&#039;ve looked over my SQL statement but can&#039;t see what&#039;s causing the error. Suggestions?<BR>Thanks,<BR>DJ

  2. #2
    Join Date
    Dec 1969

    Default Understanding error messages...

    VBScript compilation error <BR><BR>That means that you have a basic problem in your VBScript code.<BR>One that has nothing at all to do with your SQL code, per se.<BR><BR>You haven&#039;t even got past the compilation phase of VBScript, so you haven&#039;t started *running* anything, so the DB (and SQL) isn&#039;t involved at all.<BR><BR>HINT: You are missing an & operator.<BR><BR>But that SQL *will* probably have problems, because Password is *certainly* a keyword in Access (and I think in most DBs). And when you use a keyword as a field name, then you have to put the field name in [...] to avoid having it interpreted incorrectly.<BR><BR>... "&#039; AND [Password] = &#039;" ...<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts