Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Don't know this error...Pls Help!!!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am not sure about the following errors....


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

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'WHERE'.

/up.asp, line 46


<%

if(Request(&quot;Submit&quot;) <> &quot;&quot; ) then

Dim adoCon , adoRec ' ADO connection object
Dim ConnString
Dim myNameID, myUserID, myPwd, myCou, myYr, myEmail, SQL

myUserID = Request.Form (&quot;text&quot;)
myPwd = Request.Form (&quot;password&quot;)


Set adoCon = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set adoRec=server.CreateObject (&quot;ADODB.Recordset&quot;)
ConnString=&quot;driver={sql server};server=o6f2e1;database=user;DSN=localserver;PWD=;UID=sa;&quot;
adoCon.Open ConnString

adoRec.ActiveConnection = adoCon

SQL=&quot;UPDATE info &quot; & _
&quot;SET password='&quot; & myPwd & &quot;', &quot; & _
&quot;WHERE UserID='&quot; & myUserID & &quot;'&quot;

line 46 ) adoCon.Execute (SQL)

adoCon.Close
Set adoCon = Nothing

Response.Redirect (&quot;Success.asp&quot;)

else%>
<script>
window.alert (&quot;Not OK&quot;)
</script>
<%End if
%>
 
Something is not getting formatted correctly in the SQL string.

Before the execute do
Response.Write SQL
Response.End

Then check out your sql string, you should find the error.
 
I'd be willing to be that the &quot;myUserID&quot; variable being requested from the last page never received a value, therefore you're talling to ti update the db on a record that has the match of userID=&quot;&quot;

as cmmrfrds said, the only way to really tell is to write the sql statement to your screen, and end the response object to see what the sql statement actually looks like at execution time. -Ovatvvon :-Q
 
If you only have one column in your UPDATE statement, do not include a comma....

So this....
SQL=&quot;UPDATE info &quot; & _
&quot;SET password='&quot; & myPwd & &quot;', &quot; & _
&quot;WHERE UserID='&quot; & myUserID & &quot;'&quot;

Should be...
SQL=&quot;UPDATE info &quot; & _
&quot;SET password='&quot; & myPwd & &quot;' &quot; & _
&quot;WHERE UserID='&quot; & myUserID & &quot;'&quot;


To help you find problems like this in your SQL statements, it always helps to print them to the screen (Response.write...) before executing, just to make sure everything is alright.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top