S
sista via DotNetMonster.com
hi.. just wondering what does this error means?
here's my vb code:
Imports System.Web.Security
Imports System.Data
Imports System.Data.OleDb
Public Class dpitem
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Protected WithEvents MyDataList As System.Web.UI.WebControls.DataList
Protected WithEvents mydatalist2 As System.Web.UI.WebControls.DataList
Protected WithEvents sc As System.Web.UI.WebControls.HyperLink
Protected WithEvents name As System.Web.UI.WebControls.Label
Protected WithEvents subs As System.Web.UI.WebControls.Label
Protected WithEvents qty As System.Web.UI.WebControls.Label
Protected WithEvents buyqty As System.Web.UI.WebControls.TextBox
Protected WithEvents add As System.Web.UI.WebControls.ImageButton
Protected WithEvents dg As System.Web.UI.WebControls.DataGrid
Protected WithEvents lblTotal As System.Web.UI.WebControls.Label
Dim pid As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
makeCart()
End If
Dim ds As DataSet
Dim ds2 As DataSet
Dim MyConnection As OleDbConnection
Dim MyCommand As OleDbDataAdapter
pid = Request.QueryString("pid")
Dim P As New PartyHouse
ds = P.getSub("*", "lydiasun_product", "pid", pid, "", "")
MyDataList.DataSource = ds.Tables("lydiasun_product").DefaultView
MyDataList.DataBind()
With ds.Tables("lydiasun_product").Rows(0)
name.Text = .Item("pname")
subs.Text = .Item("subcategory")
sc.Text = .Item("subcategory")
sc.NavigateUrl = "subcategory.aspx?subcategory=" & .Item
("subcategory")
qty.Text = P.sizing(.Item("allsizes"), .Item("small"), .Item
("medium"), .Item("large"))
End With
ds2 = P.getSub("distinct subcategory", "lydiasun_product",
"category", "Decoration & Props", "", "")
mydatalist2.DataSource = ds2.Tables("lydiasun_product").DefaultView
mydatalist2.DataBind()
End Sub
Dim objDT As DataTable
Dim objDR As DataRow
Sub addtocart(ByVal s As Object, ByVal e As ImageClickEventArgs)
'Dim pid As String = Request.QueryString("pid")
'Dim ds As DataSet
'Dim p As New PartyHouse
lblTotal.Text = "pid is:" & pid
Dim match As Boolean
objDT = Session("cart")
'ds = p.getSub("*", "lydiasun_product", "pid", pid, "", "")
If objDT.Rows.Count = 0 Then
objDR = objDT.NewRow
objDR("pid") = "dpp101"
objDR("qty") = CInt(Request.Form("buyqty"))
objDR("price") = 1.99
'With ds.Tables("lydiasun_product").Rows(0)
' objDR("pid") = .Item("pid")
' objDR("qty") = Request.Form("buyqty")
' objDR("img") = .Item("img")
' objDR("pname") = .Item("pname")
' objDR("pdesc") = .Item("pdesc")
' objDR("price") = .Item("price")
If Session("email") = "" Then
objDR("user") = "guest"
Else
objDR("user") = Session("email")
End If
'End With
'objDR("size") = "all size"
objDT.Rows.Add(objDR)
Else
For Each objDR In objDT.Rows
If objDR("pid") = pid Then
objDR("qty") += CInt(Request.Form("buyqty"))
match = True
Exit For
End If
Next
If Not match Then
objDR = objDT.NewRow
'With ds.Tables("lydiasun_product").Rows(0)
objDR("pid") = pid
objDR("qty") = CInt(Request.Form("buyqty"))
objDR("price") = 1.99
'objDR("img") = .Item("img")
'objDR("pname") = .Item("pname")
'objDR("pdesc") = .Item("pdesc")
'objDR("price") = .Item("price")
If Session("email") = "" Then
objDR("user") = "guest"
Else
objDR("user") = Session("email")
End If
'End With
'objDR("size") = "all size"
objDT.Rows.Add(objDR)
End If
End If
Session("cart") = objDT
dg.DataSource = objDT
dg.DataBind()
lblTotal.Text = lblTotal.Text & "<br>$" & GetItemTotal()
'Response.Write("<script>window.open('shoppingcart.aspx','mainmid')
;window.open('vtop.aspx','vtop');</script>")
End Sub
Function makeCart()
If Nothing(Session("cart")) Then
objDT = New DataTable("Cart")
objDT.Columns.Add("ID", GetType(Integer))
objDT.Columns("ID").AutoIncrement = True
objDT.Columns("ID").AutoIncrementSeed = 1
objDT.Columns.Add("pid", GetType(String))
objDT.Columns.Add("qty", GetType(Integer))
'objDT.Columns.Add("img", GetType(String))
'objDT.Columns.Add("pname", GetType(String))
'objDT.Columns.Add("pdesc", GetType(String))
objDT.Columns.Add("price", GetType(Decimal))
objDT.Columns.Add("user", GetType(String))
Session("Cart") = objDT
End If
End Function
Function GetItemTotal() As Decimal
Dim intCounter As Integer
Dim decRunningTotal As Decimal
For intCounter = 0 To objDT.Rows.Count - -1
objDR = objDT.Rows(intCounter)
decRunningTotal += (objDR("price") * objDR("qty"))
Next
Return decRunningTotal
End Function
End Class
here's my vb code:
Imports System.Web.Security
Imports System.Data
Imports System.Data.OleDb
Public Class dpitem
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Protected WithEvents MyDataList As System.Web.UI.WebControls.DataList
Protected WithEvents mydatalist2 As System.Web.UI.WebControls.DataList
Protected WithEvents sc As System.Web.UI.WebControls.HyperLink
Protected WithEvents name As System.Web.UI.WebControls.Label
Protected WithEvents subs As System.Web.UI.WebControls.Label
Protected WithEvents qty As System.Web.UI.WebControls.Label
Protected WithEvents buyqty As System.Web.UI.WebControls.TextBox
Protected WithEvents add As System.Web.UI.WebControls.ImageButton
Protected WithEvents dg As System.Web.UI.WebControls.DataGrid
Protected WithEvents lblTotal As System.Web.UI.WebControls.Label
Dim pid As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
makeCart()
End If
Dim ds As DataSet
Dim ds2 As DataSet
Dim MyConnection As OleDbConnection
Dim MyCommand As OleDbDataAdapter
pid = Request.QueryString("pid")
Dim P As New PartyHouse
ds = P.getSub("*", "lydiasun_product", "pid", pid, "", "")
MyDataList.DataSource = ds.Tables("lydiasun_product").DefaultView
MyDataList.DataBind()
With ds.Tables("lydiasun_product").Rows(0)
name.Text = .Item("pname")
subs.Text = .Item("subcategory")
sc.Text = .Item("subcategory")
sc.NavigateUrl = "subcategory.aspx?subcategory=" & .Item
("subcategory")
qty.Text = P.sizing(.Item("allsizes"), .Item("small"), .Item
("medium"), .Item("large"))
End With
ds2 = P.getSub("distinct subcategory", "lydiasun_product",
"category", "Decoration & Props", "", "")
mydatalist2.DataSource = ds2.Tables("lydiasun_product").DefaultView
mydatalist2.DataBind()
End Sub
Dim objDT As DataTable
Dim objDR As DataRow
Sub addtocart(ByVal s As Object, ByVal e As ImageClickEventArgs)
'Dim pid As String = Request.QueryString("pid")
'Dim ds As DataSet
'Dim p As New PartyHouse
lblTotal.Text = "pid is:" & pid
Dim match As Boolean
objDT = Session("cart")
'ds = p.getSub("*", "lydiasun_product", "pid", pid, "", "")
If objDT.Rows.Count = 0 Then
objDR = objDT.NewRow
objDR("pid") = "dpp101"
objDR("qty") = CInt(Request.Form("buyqty"))
objDR("price") = 1.99
'With ds.Tables("lydiasun_product").Rows(0)
' objDR("pid") = .Item("pid")
' objDR("qty") = Request.Form("buyqty")
' objDR("img") = .Item("img")
' objDR("pname") = .Item("pname")
' objDR("pdesc") = .Item("pdesc")
' objDR("price") = .Item("price")
If Session("email") = "" Then
objDR("user") = "guest"
Else
objDR("user") = Session("email")
End If
'End With
'objDR("size") = "all size"
objDT.Rows.Add(objDR)
Else
For Each objDR In objDT.Rows
If objDR("pid") = pid Then
objDR("qty") += CInt(Request.Form("buyqty"))
match = True
Exit For
End If
Next
If Not match Then
objDR = objDT.NewRow
'With ds.Tables("lydiasun_product").Rows(0)
objDR("pid") = pid
objDR("qty") = CInt(Request.Form("buyqty"))
objDR("price") = 1.99
'objDR("img") = .Item("img")
'objDR("pname") = .Item("pname")
'objDR("pdesc") = .Item("pdesc")
'objDR("price") = .Item("price")
If Session("email") = "" Then
objDR("user") = "guest"
Else
objDR("user") = Session("email")
End If
'End With
'objDR("size") = "all size"
objDT.Rows.Add(objDR)
End If
End If
Session("cart") = objDT
dg.DataSource = objDT
dg.DataBind()
lblTotal.Text = lblTotal.Text & "<br>$" & GetItemTotal()
'Response.Write("<script>window.open('shoppingcart.aspx','mainmid')
;window.open('vtop.aspx','vtop');</script>")
End Sub
Function makeCart()
If Nothing(Session("cart")) Then
objDT = New DataTable("Cart")
objDT.Columns.Add("ID", GetType(Integer))
objDT.Columns("ID").AutoIncrement = True
objDT.Columns("ID").AutoIncrementSeed = 1
objDT.Columns.Add("pid", GetType(String))
objDT.Columns.Add("qty", GetType(Integer))
'objDT.Columns.Add("img", GetType(String))
'objDT.Columns.Add("pname", GetType(String))
'objDT.Columns.Add("pdesc", GetType(String))
objDT.Columns.Add("price", GetType(Decimal))
objDT.Columns.Add("user", GetType(String))
Session("Cart") = objDT
End If
End Function
Function GetItemTotal() As Decimal
Dim intCounter As Integer
Dim decRunningTotal As Decimal
For intCounter = 0 To objDT.Rows.Count - -1
objDR = objDT.Rows(intCounter)
decRunningTotal += (objDR("price") * objDR("qty"))
Next
Return decRunningTotal
End Function
End Class