Results 1 to 2 of 2

Thread: SQL making me weep

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Alberton, Gauteng, South-Africa
    Posts
    48

    Unhappy

    Hey all

    I have a Small problem with my SQL statement, it sees my WHERE statements. But takes the condition as a coloumn name. it's suposed to check for a value in that coloumn and return the value of that row.
    Here's my code:

    ****

    Dim conn
    Dim rsResults
    Dim UserName
    Dim PWD
    Dim aConnect
    Dim SQL

    UserName = Request.Querystring("sUID")
    PWD = Request.Querystring("sPWD")
    aConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=DEV-SVR;Initial Catalog=Alchemy;User ID=Guest;Password=;ConnectionTimeout=10;"

    Set conn = Server.CreateObject("ADODB.Connection")
    Set rsResults = Server.CreateObject ("ADODB.Recordset")
    conn.Mode = abModeReadWrite
    conn.ConnectionString = aConnect
    conn.open

    Set rsResults = conn.Execute("SELECT User_PWD FROM Users WHERE User_UID = " & UserName & " ")

    if PWD = rsResults("User_PWD") Then
    Response.Write "UserID and Password Matches"
    else
    Response.Write "No matching Results"
    end IF

    rsResults.Close
    conn.Close

    ********

    Thanks in Advance
    ;-)
    Jaco
    South-Africa

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124
    You need to put a single quote before and after your UserName

    Set rsResults = conn.Execute("SELECT User_PWD FROM Users WHERE User_UID = '" & UserName & "' ")

Posting Permissions

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



Click Here to Expand Forum to Full Width