Do you have a second page that posts to this page? If so, does that page have a text box called username?
Take a look at this:
Code:
username = Request.Form("username")
...
sqlString = "Select * from user where username = '" & username & "'"
You build up a Sql statement by getting the user name from the Request.Form collection. Does that ever get a correct value?
Then again, this shouldn't cause the problem, because when the text box is empty or does not exist, you end up with something like :
Select * from user where username = ''
which should work.
The problem could be caused by the table name: user. That is actually a reserved keyword (
http://support.microsoft.com/kb/q109312/)
Either rename the table, or enclose it in brackets:
Select * from [user] where username = '" & username & "'"
(Renaming is a better solution, IMHO)
To diagnose the problem, write out the Sql statement before you execute it, and then paste the statement in the Access query designer so you can test it out. To write out the statement, modify your code so it looks like this (the bold parts are new):
Code:
sqlString = "Select * from user where username = '" & username & "'"
Response.Write("SQL is " & sqlString & "<br />")
Response.End()
set rsTitleList = myconnection.Execute(sqlString)
If all this doesn't help, can you post the code for the entire page, including the stuff with the <form> and <input> tags?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Into My Arms by
Nick Cave & the Bad Seeds (Track 1 from the album:
The Boatman's Call)
What's This?