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 December 4th, 2007, 11:42 AM
Registered User
 
Join Date: Dec 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP/SQL question

I am programming a site and when i log in i get this message...

Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near ')'.

C:\INETPUB\WWWPA\STUDENTS\../shared/infoCenter/center_inbox.asp, line 15

90% of the page comes up however, this section is suppose to be a discussion board and it does not appear.

Here is the code for that section (the last line of this code is line 15)

'Build Recordset and Connection
    SET THISONE = server.CreateObject ("ADODB.Connection")
    THISONE.Open Application("THISONE_ConnectionString")
    SET RS1 = server.createobject("ADODB.Recordset")
    SQLString = "SELECT tblBoardInbox.BIReplies, tblBoardInbox.BIID, tblBoardInbox.BTID, tblBoardThreads.BTSubject, tblBoardThreads.BTDateTime, tblBoardThreads.BCID " & _
      "FROM tblBoardInbox INNER JOIN tblBoardThreads ON tblBoardInbox.BTID = tblBoardThreads.BTID " & _
      "WHERE (tblBoardInbox.UID = " & vUserID & ")" & _
       vSQLString 'from students and faculty
    RS1.Open SQLString,THISONE,adOpenKeyset,adLockReadOnly,adCm dText


Please help

 
Old December 4th, 2007, 01:23 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The issue is in your SQL String, it is invalid because you are not concatnating strings correctly. If you fix that, your error will go away. =]

================================================== =========
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
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old December 4th, 2007, 05:15 PM
Registered User
 
Join Date: Dec 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the response. However, all i did was copy and paste this .asp file from an older website (which works) to my new website.

The code is identical in both projects. Is there anything directly that i could try?

I put a Response.Write("vSQLString") Response.End to see what the output is. Would that help to know that information?

Thanks again for your willingness to help!

 
Old December 4th, 2007, 05:48 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do Response.Write(vSQLString) to see the literal value of your SQL string. That will help you find the problem, yes.

================================================== =========
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
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old December 4th, 2007, 05:54 PM
Registered User
 
Join Date: Dec 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When i do the Response.Write(vSQLString) i get this on the webpage...

;SELECT * FROM vw_classes_student WHERE (UID = ) AND (Status = 'Current') ORDER BY CourseTitle, ClassID

Could there be a syntax problem in a table/view in the database? If so based on the code given so far would you know which one i should start looking at or what i should be looking for? I think i have looked at this for so long i have blinded myself from the problem.

Thanks

 
Old December 4th, 2007, 07:38 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You don't see anything odd about this SQL Query?? You are not supplying a value for the first parameter of your where statment. (UID= )

Also this doesn't make sesne:
SQLString = "SELECT tblBoardInbox.BIReplies, tblBoardInbox.BIID, tblBoardInbox.BTID, tblBoardThreads.BTSubject, tblBoardThreads.BTDateTime, tblBoardThreads.BCID " & _
      "FROM tblBoardInbox INNER JOIN tblBoardThreads ON tblBoardInbox.BTID = tblBoardThreads.BTID " & _
      "WHERE (tblBoardInbox.UID = " & vUserID & ")" & _
       vSQLString

You said that the result of Response.Write(vSQLString) yeilded:
;SELECT * FROM vw_classes_student WHERE (UID = ) AND (Status = 'Current') ORDER BY CourseTitle, ClassID

so the code above is going to evaluate to something like:
SQLString = "SELECT tblBoardInbox.BIReplies, tblBoardInbox.BIID, tblBoardInbox.BTID, tblBoardThreads.BTSubject, tblBoardThreads.BTDateTime, tblBoardThreads.BCID " & _
      "FROM tblBoardInbox INNER JOIN tblBoardThreads ON tblBoardInbox.BTID = tblBoardThreads.BTID " & _
      "WHERE (tblBoardInbox.UID = " & vUserID & ") ;SELECT * FROM vw_classes_student WHERE (UID = ) AND (Status = 'Current') ORDER BY CourseTitle"

This makes no sense?

================================================== =========
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
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Question psnow1985 ASP.NET 2.0 Basics 23 March 21st, 2008 11:48 AM
ASP / Sql question joebeem Classic ASP Basics 0 August 28th, 2007 02:45 PM
A SQL question pankaj_daga Access 5 December 5th, 2005 04:37 PM
Time Question on SQL/ASP mg1966 Classic ASP Databases 4 January 24th, 2005 11:48 PM
Sql-question boson SQL Language 2 July 3rd, 2004 06:39 AM





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