Multiplying 2 numbers in a datagrid

windows

Guest
My third "plea" of the afternoon.

Does anybody know how I can mulitply 2 numbers that are in a datagrid, that is looking at a query table from an access database. (Also I want it to be a loop in the data reader so it multiplies the 2 numbers for every record ... price * quantity). The total number is then displayed in the label - lbltotalcost

This is what i've got so far...
int vtcost = Convert.ToInt32(e.Item.Cells[3].int) * Convert.ToInt32(e.Item.Cells[4].int)

while(dataReader.Read())
{
lbltotalcost.Text += vtcost;
}why don't you do the math inside of your query? That means no extra looping and faster page load times.

Eric
 
Top