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 March 14th, 2004, 12:36 PM
Authorized User
 
Join Date: Jan 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error about CartID?

Hi All
I have a problem about CartID in ShoppingCart.aspx (from IBuySpy.com,the sample from www.asp.net) Now, I can insert data from the selected product (in ProductDetail.aspx) to ShoppingCart Table that I set it in oracle9. By this code:

Public Sub AddItem(ByVal cartID As String, ByVal productID As String, ByVal quantity As Integer)
            Dim myConnString As String = _
                   "user id=scott;integrated security=False;data source=orcl;password=tiger"
            Dim myConnection As New OracleConnection(myConnString)

            ' Create Instance of Connection and Command Object
            Dim myCommand As OracleCommand = New OracleCommand("SHOPPINGCARTADDITEM", myConnection)

            ' Mark the Command as a SPROC
            myCommand.CommandType = CommandType.StoredProcedure
            ' *********************************************

            ' Add Parameters to SPROC
            Dim parameterProductID As OracleParameter = New OracleParameter("I_ProductID", OracleType.VarChar, 4)
            parameterProductID.Value = productID
            myCommand.Parameters.Add(parameterProductID)

            Dim parameterCartID As OracleParameter = New OracleParameter("I_CartID", OracleType.VarChar, 10)
            parameterCartID.Value = cartID
            myCommand.Parameters.Add(parameterCartID)

            Dim parameterQuantity As OracleParameter = New OracleParameter("I_Quantity", OracleType.Number, 4)
            parameterQuantity.Value = quantity
            myCommand.Parameters.Add(parameterQuantity)

            ' Open the connection and execute the Command
            myConnection.Open()
            myCommand.ExecuteNonQuery()
            myConnection.Close()

        End Sub
***************************
The value of field “ CartID” is some character like this “553e23c8-3” That I’m not understand in its meaning.

Public Function GetShoppingCartId() As String

            ' Obtain current HttpContext of ASP.NET Request
            ' UNDONE: fix this
            Dim context As HttpContext = HttpContext.Current

            ' If the user is authenticated, use their customerId as a permanent shopping cart id
            If context.User.Identity.Name <> "" Then
                Return context.User.Identity.Name
            End If

            ' If user is not authenticated, either fetch (or issue) a new temporary cartID
            If Not context.Request.Cookies("ASPNETCommerce_CartID") Is Nothing Then
                Return context.Request.Cookies("ASPNETCommerce_CartID").V alue
            Else
                ' Generate a new random GUID using System.Guid Class
                Dim tempCartId As Guid = Guid.NewGuid()

                ' Send tempCartId back to client as a cookie
                context.Response.Cookies("ASPNETCommerce_CartID"). Value = tempCartId.ToString()

                ' Return tempCartId
                Return tempCartId.ToString()
            End If

        End Function
*********************************
And this is a procedure for ShoppingCartList

(CARTID IN VARCHAR2)
As
PRD_PRODUCTID VARCHAR2(4);
PRD_PRODUCTTITLE VARCHAR2(50);
QUANTITY NUMBER(4);
PRD_UNITPRICE NUMBER(10,2);
EXTENEDAMOUNT NUMBER(10,2);
begin
SELECT TBLPRODUCT.PRD_PRODUCTID,TBLPRODUCT.PRD_PRODUCTTIT LE,
SHOPPINGCART.QUANTITY,
TBLPRODUCT.PRD_UNITPRICE,
TBLPRODUCT.PRD_UNITPRICE*SHOPPINGCART.QUANTITY
INTO
PRD_PRODUCTID,PRD_PRODUCTTITLE,QUANTITY,PRD_UNITPR ICE,EXTENEDAMOUNT
FROM
TBLPRODUCT,SHOPPINGCART
WHERE
TBLPRODUCT.PRD_PRODUCTID=SHOPPINGCART.PRODUCTID
AND
SHOPPINGCART.CARTID=CARTID
ORDER BY
TBLPRODUCT.PRD_PRODUCTTITLE;
end;

*********************************
But it doesn’t show anything (like a data that is inserted into ShoppingCart Table) in datagrid of ShoppingCart.aspx. I then try to select the other product again and it shows error as the following.

ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at "SCOTT.SHOPPINGCARTLIST", line 9 ORA-06512: at line 1
Have anyone know about this error?

Thanks in advance

Blueman137


 
Old March 16th, 2004, 09:04 AM
aas aas is offline
Authorized User
 
Join Date: Mar 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to aas
Default

look of my answer about ORA-01422 in topic: http://p2p.wrox.com/topic.asp?TOPIC_ID=11035






Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 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
[Resolved] Error calling a sp - parameter error snufse .NET Framework 2.0 2 February 12th, 2008 04:46 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





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