Incorrect SQL Syntax??!
I am trying to make data from an access database apear when a user enters in a username. This username (on an HTML form) is turned into a variable, (varname). I then run an SQL Select statement that compares the username entered (stored into the varname variable) and brings up other fields of the same record. Here is the code.
sqltext="SELECT * FROM people"
sqltext=sqltext& "Where lastname=" &varname&";"
rs.open sqltext, "DSN=test"
Your First Name is <%rs("firstname")%>
I keep getting this error,
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/datatest/testname.asp, line 12
What is the correct way of referncing a string (text) variable in a SQL Select statement?!!
I have tried putting ' around the varname like this........
Where lastname='" &varname&"';"
Please email or post, thank you very much