p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Re: HELP - - what's wrong with my code?


Message #1 by "Peter Foti (PeterF)" <PeterF@S...> on Mon, 3 Jun 2002 13:09:25 -0400
Missing an end quote:

 WHERE StudentID = & Session("StudentID")  

Should be:

 WHERE StudentID = " & Session("StudentID")  
Message #2 by "Brian O'Neill" <snowmanco@y...> on Mon, 3 Jun 2002 18:02:16
Try making that statment on one line.


> Hi all,
> I have a problem that has to do with update statement.Could anybody help 
> me? I'm using an Access database with OLE-DB Connection.
> I have created a form with 3 text fields that a user fills with the old 
> password,the new password and the confirmation of the new password.
> 
> Here's the code:
> 
> <!-- #include file="DataStore.asp" -->
> <!-- METADATA TYPE="typelib" 
>               FILE="C:\Program Files\Common 
Files\System\ado\msado15.dll" -
> ->
> <HTML>
> <HEAD>
> <TITLE>Update Password</TITLE>
> </HEAD>
> <BODY bgcolor="#FFFFFF" text="#000000">
> <% 
>   Dim objCmd
>   Set objCmd = Server.CreateObject("ADODB.Command")
>   strSQL = "UPDATE Students SET Password = '" & Request.Form
("txtnewpwd") 
> & "' WHERE StudentID = & Session("StudentID")  
>   objCmd.CommandText = strSQL
>   objCmd.CommandType = adCmdText
>   Set objCmd.ActiveConnection = objConn
>   objCmd.Execute
>   Response.Redirect"UserProfile_after.asp"
>  %>
> </BODY>
> </HTML>
> 
> Here's the error:
> Error Type:
> Microsoft VBScript compilation (0x800A0409)
> Unterminated string constant
> /onlinecampus/UpdatePassword.asp, line 15, column 76
> strSQL = "UPDATE Students SET Password = '" & Request.Form("txtnewpwd") 
> & "'
> 
> What am I doing wrong??
> 
> Thank you!
> --tsivas

  Return to Index