kvnsdr
asked on
Shopping Cart DataSet Total Problem?
I've been using a session dataset to hold products and a cookie to hold the total.
How can I make the dataset hold the total as well?
I'm using this code to add the total to a row:
DataSet ds = (DataSet)Session["myds"];
DataRow row = ds.Tables["tbl_Sales"].New Row();
row["col_Total"] = runningTotal.ToString();
ds.Tables["tbl_Sales"].Row s.Add(row) ;
However, I never know which row will contain the actual accurate running total.
The row will vary according to the number of products added before the row.
I use this code to retrieve the total although "Rows[3 -10]" varies
Amount.Text = ds.Tables["tbl_Sales"].Row s[3]["col_ Total"].To String();
How can I make the dataset hold the total as well?
I'm using this code to add the total to a row:
DataSet ds = (DataSet)Session["myds"];
DataRow row = ds.Tables["tbl_Sales"].New
row["col_Total"] = runningTotal.ToString();
ds.Tables["tbl_Sales"].Row
However, I never know which row will contain the actual accurate running total.
The row will vary according to the number of products added before the row.
I use this code to retrieve the total although "Rows[3 -10]" varies
Amount.Text = ds.Tables["tbl_Sales"].Row
you're probably better off keeping the total in a column using a SUM("moneycolumnname") AS Total in your SELECT statement that fills the dataset.
or i guess you have some SP that gets the total for you, so i'm not sure why you want to put it in a row in your dataset.
ASKER
Is it common to use both session dataset and cookie for total?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.