Hello,
I am following the IbuySpy store codes and i use MS Access2000 as back
end. I'm having problem getting computing/getting the "Total" price.
Here is the Label control that should contain the result of GetTotal method.
lblTotal.Text = String.Format( "{0:c}", GetTotal(cartID));
and here is the method (this is incorrect,don't mind the syntax error):
-------------------
public string GetTotal(string cartID) {
string strconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(".//db//db1.mdb");
OleDbConnection myConnection = new OleDbConnection(strconn);
myConnection.Open();
string strgettotal ="Select SUM(c.productQuantity * p.productCost) as Total FROM products p, cart c WHERE
c.cartID='"+cartID.ToString()+"' and p.productID=c.productID" ;
OleDbCommand myCommand = new OleDbCommand(strgettotal, myConnection);
OleDbDataReader myreader=myCommand.ExecuteReader(CommandBehavior.CloseConnection);
return Total; //-->I want to return the Total field, how?
}
------------------
Any recommendation/suggestion/comments/help/ appreciated.
Thanks,
mel :-)
__________________________________
www.edsamail.com