Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 5th, 2003, 01:25 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
<html>
<head>
<title>ASP Script</title>
</head>
<%
dim rs
dim varname
varname=Request.form("name")
set rs=server.createobject("ADODB.recordset")
sqltext="SELECT * FROM people"
sqltext=sqltext& "Where lastname=" &varname&";"
rs.open sqltext, "DSN=test"
%>
Your First Name is <%rs("firstname")%>
<body>
</body>
</html>

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
Reply With Quote
  #2 (permalink)  
Old June 5th, 2003, 01:37 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ahhhi figured it out i was missing a space betwen the sqltext parts.

Thanks
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect syntax near '.' meraj ADO.NET 6 February 27th, 2012 01:01 AM
Incorrect syntax near '!' sinapra Classic ASP Databases 8 August 25th, 2004 02:15 AM
Incorrect syntax near '`' Hez Classic ASP Databases 3 August 5th, 2004 08:13 AM
Incorrect syntax...... Adam H-W Classic ASP Databases 8 June 21st, 2004 11:14 AM
Incorrect SQL Syntax?! ckudrna Access VBA 1 June 5th, 2003 03:07 PM



All times are GMT -4. The time now is 06:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.