Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old December 12th, 2006, 02:06 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax Error

Hi,

I keep receiving the following error. Can anyone help :

Syntax error (missing operator) in query expression '[tblCartItems].[intCartID] ='.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression '[tblCartItems].[intCartID] ='.

Source Error:


Line 42:
Line 43: dbConnection.Open
Line 44: Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)
Line 45:
Line 46: Return dataReader


The issue lies around the following select statement :

Dim queryString As String = "SELECT tblCartItems.intCartitemID, tblCartItems.intProductID, tblMake.strMake, " & _
        "tblProducts.strProductName, tblType.strTypeDetails, tblColour.strColour, tblCartItems.intQuantityOrder, tblCartItems.curSalePrice " & _
        "FROM tblType INNER JOIN ((tblMake INNER JOIN (tblColour INNER JOIN tblProducts ON tblColour.intColourID = tblProducts.intColourID) " & _
        "ON tblMake.intMakeID = tblProducts.intMakeID) INNER JOIN tblCartItems ON tblProducts.intProductID = tblCartItems.intProductID) " & _
        "ON tblType.intTypeID = tblProducts.intTypeID " & _
        "WHERE [tblCartItems].[intCartID] = " & Session("CartID") & " ; "


If I remark out the last line i.e. "WHERE [tblCartItems].[intCartID] = " & Session("CartID") & " ; "

the error disappears. However I still need to reference the CartID session object. I've tried combining the entire section of code, but the error remains. The issues lies around the part :


 = " & Session("CartID") & " ; "

I'm using asp.net 1.1 with vb2003 -

Thanks,

  #2 (permalink)  
Old December 12th, 2006, 02:13 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

are you sure you have something inside session("CartID"), b/c that the error you are getting. Maybe you are not filling the session variable properly or it have another name????

HTH

Gonzalo
  #3 (permalink)  
Old December 12th, 2006, 02:23 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I agree with gonzalo; are you certain that Session("CartID") contains a value? It seems very likely that the value is empty. I would step through the code and verifiy that the query string is what you expect it to be.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
  #4 (permalink)  
Old December 12th, 2006, 04:51 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Both.

This is a checkout page and you're right that the cartID is blank. Therefore should I use an if statement to say if value is nothing......etc ?

Thanks,

  #5 (permalink)  
Old December 12th, 2006, 05:13 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes you could do:

if(Convert.ToString(Session("cartID")) == "")
{
     //do something
}
else
{
    //process order
}

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
  #6 (permalink)  
Old December 14th, 2006, 02:01 PM
Authorized User
 
Join Date: Sep 2006
Location: , , .
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks both - now got it working....



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
VB Error: Syntax Error or Access Violation codehappy VB How-To 7 October 3rd, 2007 05:41 PM
Compile error: Syntax error: & Else without HELP Corey VB How-To 2 April 21st, 2006 03:25 PM





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