p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

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


Message #1 by "tsivas" <tsivas@o...> on Mon, 10 Dec 2001 00:16:10
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

Message #2 by "Ken Schaefer" <ken@a...> on Mon, 10 Dec 2001 12:10:00 +1100
: strSQL = "UPDATE Students SET Password = '" & Request.Form("txtnewpwd") 

: & "' WHERE StudentID = & Session("StudentID")  



Look at the bit after StudentID = 

You don't have a " before the &



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "tsivas" <tsivas@o...>

Subject: [asp_databases] HELP - - what's wrong with my code?





: 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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "Obet Regino" <rvregino@s...> on Mon, 10 Dec 2001 09:14:14 +0800
You missed the double quote after WHERE StudentID = ?.



& "' WHERE StudentID = " & Session("StudentID")





-----Original Message-----

From: tsivas [mailto:tsivas@o...]

Sent: Monday, December 10, 2001 12:16 AM

To: ASP Databases

Subject: [asp_databases] HELP - - what's wrong with my code?





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






$subst('Email.Unsub').



Message #4 by Mark Eckeard <meckeard2000@y...> on Sun, 9 Dec 2001 21:39:41 -0800 (PST)
Should the session var studentid have quotes around

them?



--- tsivas <tsivas@o...> wrote:

> 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

> 





$subst('Email.Unsub').





__________________________________________________

Do You Yahoo!?

Send your FREE holiday greetings online!

http://greetings.yahoo.com


  Return to Index