Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 April 25th, 2007, 03:38 PM
Authorized User
 
Join Date: Feb 2007
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in SQL syntax

I'm having trouble with this :

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') union (select distinct(gSim_host) from gprsSims where id=) union (select disti' at line 1

where :
Code:
function hostList()
    dim dbConn, db_rec, sql
 
    set dbConn = Server.createObject("adodb.connection")
    set db_rec = Server.createObject("adodb.recordset")
 
    dbConn.open(db_connstr)


    sql =    "(select distinct (sSim_host) from srpcSims where id=" &projID& ") union (select distinct(gSim_host) from gprsSims where id=" & projID & ") union (select distinct(tSim_host) from tachSims where id=" & projID &")" 

       'response.write sql
       'response.end     
      db_rec.open sql, dbConn



    while not db_rec.eof        
        hostList = hostList & "<option>" & db_rec.fields(0) & "</option><br>"
        db_rec.movenext
    wend 

    db_rec.close
    dbConn.close
    set db_rec = nothing
    set db_con = nothing    

end function
 
Old April 26th, 2007, 07:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. looks like projID is empty (whatever it is...)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Example SQL causes syntax error Tom Rigby BOOK: Beginning SQL 1 April 18th, 2007 09:32 AM
SQL syntax error - Chapter 3 cutthroatchemist BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 January 15th, 2007 06:19 PM
SQL Syntax Error I can't figure out Syster Tara Classic ASP Basics 24 December 2nd, 2006 05:09 PM
Syntax error on SQL statement Chris1 Access VBA 1 September 7th, 2004 07:47 AM
$sql="CREATE TABLE syntax error cedtech23 Beginning PHP 3 August 24th, 2004 04:56 AM





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