Random
Random

Reputation: 21

ODB ERROR 80040e14 ASP CLASSIC

What's wrong with my code? keep showing this error message

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

[MySQL][ODBC 5.2(w) Driver][mysqld-5.5.28-log]You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax
to use near ''' at line 1

/login/update2.asp, line 12 

Line 12 Set rs = objRS.Execute(mySQL)

    <%
    DIM strUsername
    strUsername = Request.Form("Username")
    IF strUsername <> "" THEN
    %>

    <%
    DIM mySQL, objRS 
    mySQL = "SELECT username, email_addr  FROM medacist_user WHERE username = " & strUsername & " ' "
    Set objRS = Server.CreateObject("ADODB.Connection")
    objRS.Open "Provider=MSDASQL.1;Password=langas;Persist Security Info=True;User ID=mmsg;Data Source=mmsg_web"   
    Set rs = objRS.Execute(mySQL)

    IF objRS.EOF THEN
    Response.Write "<div align='center'>Sorry, that username does not exist. Please click back on your browser and enter a different username.</div>"

    ELSE
    %>

    <form name="UpdatePassword" method="post" action="reset_form.asp">
    <table>
    <tr><td>Customer:</td><td>
    <input type="text" name="Username" size="50" value='<%=objRS("Username")%>'>
    </td></tr>
    <tr><td>Password:</td><td>
    <input type="text" name="Password" size="50" value='<%=objRS("Password")%>'>
    </td></tr>
    </table>
    <input type="submit" name="Submit" value="Submit">
    </form>

    <%
    END IF

    objRS.Close
    Set objRS = Nothing
    %>

    <%
    ELSE
    Response.Write "Please click back on your browser and enter your username."
    END IF
    %>

Upvotes: 0

Views: 2032

Answers (1)

pee2pee
pee2pee

Reputation: 3792

mySQL = "SELECT username, email_addr  FROM medacist_user WHERE username = '" & strUsername & " ' "

You added the end apostophe to designate the string but not the starting one.

Upvotes: 2

Related Questions