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 26th, 2007, 12:23 PM
Authorized User
 
Join Date: Sep 2006
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataReader Query

Hi,

Can anyone advise why the following code is failing ? The code is

written in asp.net1.1 using vb.net and connected to an access

database. The following code is taken from a function and the purpose

of this code is to check to see if an item has already been added to

the shopping cart.

The cart takes the form of a datagrid and if the item located by the

productID, already exists in the cart, then I just want the quantity

value increased by one in the datagrid. This is achieved by calling

the "IncrementCartItem" function. Otherwise the item is inserted as a

new row in the datagrid by calling the "UpdatetblCartItems" function.


I get no errors but I've tried testing the code and it seems to be

failing on the IF DataReader code. I don't think it gets as far as the

IncrementCartItem or UpdatetblCartitems functions - any ideas why,

thanks.....?


Code:
 If DataReader.Read() = true

                'Set datareader values
               intmyCartID = dataReader("intCartID")
                intmyProdID = dataReader("intProductID")
                intmyQuantity = dataReader("intQuantityOrder")

                'Call function to increase quantity by one if 

productID already found in cart
                IncrementCartItem(intmyCartID, intmyProdID, 

intmyQuantity)

                'Otherwise just update cart

                Else 

UpdatetblCartItems(Session("CartID"),Quantity,intProductID,ts)


 
Old April 26th, 2007, 12:42 PM
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.. which error do you receive?? b/c the code looks ok to me...

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
================================================== =========
 
Old April 27th, 2007, 11:38 AM
Authorized User
 
Join Date: Sep 2006
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,

No error received. A colleague suggested the SQL statement could be the issue, so here it is :

        Dim queryString As String = "SELECT [tblCartItems].[intCartID], [tblCartItems].[intQuantityOrder], [tblCartIte"& _
            "ms].[intProductID] FROM [tblCartItems] WHERE [tblCartItems].[intProductID] = @intProductID AND [tblCartItems].[intCartID] = @CartID"


 
Old April 27th, 2007, 12:02 PM
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

still don't know what your problem is.. maybe that sql doesn't return anything????

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
datareader MunishBhatia ASP.NET 2.0 Professional 2 October 17th, 2007 07:05 AM
Datareader Query rsm42 ASP.NET 1.0 and 1.1 Basics 1 January 8th, 2007 05:08 PM
regarding datareader adityamadisetty VB.NET 1 May 8th, 2006 09:31 AM
DataReader truongnnhat ASP.NET 1.0 and 1.1 Basics 2 February 18th, 2005 12:41 AM
DataReader cjcd BOOK: Beginning ASP.NET 1.0 2 March 21st, 2004 01:06 PM





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