Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2006, 01:15 AM
Authorized User
 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql problem

i have a code like this;
scity= Request.Form("city")
' DB connection
dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
  sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  "Data Source=" & Server.MapPath("blood.mdb") & ";" & _
  "Persist Security Info=True"
Conn.Open(sConnection)

' count all records
allrecords = 0
set rs = conn.Execute "SELECT * FROM "& scity


other code is well working ...
but the statement
set rs = conn.Execute "SELECT * FROM "& scity

is giving the error as;
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test/donors.asp, line 16, column 22
set rs = conn.Execute "SELECT * FROM "& scity
---------------------^


so i cannot get it.. i need help plz


shri
__________________
shri
 
Old May 24th, 2006, 01:55 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shri

If scity is a string then try this code :

Set rs = conn.Execute "SELECT * FROM '" & scity & "'"

If it doesn't help , let me know :)

 
Old May 24th, 2006, 09:58 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need parenthesis:
set rs = conn.Execute("SELECT * FROM " & scity)

You probably also need the single quotes as Kati states.
That will be the next error you get after you fix the parenthesis if you don't fix it.


Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL problem MArk_dB BOOK: Beginning ASP 3.0 1 December 16th, 2007 07:33 AM
SQL Problem pannet1 BOOK: Access 2003 VBA Programmer's Reference 4 April 16th, 2005 10:03 PM
SQL problem Lexus SQL Language 2 January 20th, 2005 09:25 AM
SQL problem Clive Astley Access VBA 4 October 19th, 2004 10:42 AM
SQL Problem tjw Access 1 November 12th, 2003 09:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.