View Single Post
Old April 25th, 2004, 09:11 AM
andy11983 andy11983 is offline
Registered User
Join Date: Apr 2004
Location: stoke, staffs, United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the help Imar,

With regards to the connection we have to do it that way (lecturer said so)Belwo is the ammended code

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title>Untitled Document</title>

'Function to see what the user has entered
Function ChkString(string)
If String = "" Then String = " "
ChkString = replace(String, "'", " ")
End Function

dim username, conn
strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db/cds.mdb")
set conn = server.createobject("adodb.connection") strconn

username = ChkString(request.form("login"))

SQLQuery = "SELECT * FROM users WHERE username = '"
sqlquery = sqlquery & username & "'"
Set RSuser = conn.Execute(SQLQuery)

if NOT RSuser.eof then
dim oldpassword, newpassword1, newpassword2

oldpassword = ChkString(request.form("oldpassword"))
newpassword = ChkString(request.form("newpassword1"))
newpassword2 = ChkString(request.form("newpassword2"))


SQLQuery2 = "UPDATE users SET newpassword2 = '" & newpassword2 & "' WHERE username = '"

Set RSuser = conn.Execute(SQLQuery2)

session("sesusername") = username
session("sesslocation") = ""

<div align="center">Sorry have entered your username incorrectly </div>

<%End If%>


I have made the changes that you suggested and now get the following error

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

[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression 'username = ''.

/andy11983/passchange1.asp, line 39

I would REALLY appreciate and of your or anybodys advice on how to fix this error as i have to demo thsi on tuesday morning at 9.