Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I am currently working on a PremiereProducts Database assignment. When the user selects a part to add to an order, the standard price for the part from the database are suppose to show up in the text boxes. Here is my code. The numbers in the text boxes keep showing up as zero.

VB
Public Function GetStandardPriceForPart(ByVal partnum As Integer) As Decimal
        Dim dr As SqlDataReader
        Dim price As Decimal

        cmd.CommandText = "GetPartPrice"
        cmd.Parameters.Clear()
        cmd.Parameters.Add(New SqlParameter("@partnum", partnum))

        conn.Open()
        dr = cmd.ExecuteReader()
        If dr.Read Then
            price = dr(0)
        Else
            price = 0
        End If

        conn.Close()
        Return price
    End Function   

  Protected Sub lstPart_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lstPart.SelectedIndexChanged
        Dim db As New DBWrapper
        Dim o As Order
        '  Dim l As ArrayList

        o = Session("CurrentOrder")
        '  Dim p As New PartOrdered
        ' db.GetStandardPriceForPart(lstPart.SelectedValue) = l

        txtQuantity.Text = p.NumOrdered
        txtPrice.Text = p.QuotedPrice
Posted
Updated 25-Apr-12 14:45pm
v2
Comments
VJ Reddy 25-Apr-12 20:46pm    
Edit: pre tag for VB code added.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900