I have a database with two tables customers & sales what i would like to do is in the sales datagrid is to have a total column that calculates the quantity*price columns and shows the result in the total column i don't know if i need to do this with unbound column or with a databound column i looked at the msdn2 on the mirosoft site and just got more confused hope someone can point out steps to do this. thankyou Barryt
barry t 0 Newbie Poster
Recommended Answers
Jump to Postyou create an unbound column in the sales and use the Expression property whose value is quantity*price (assuming those are the two column names). Only create bound columns if you want data saved in the database or pulled from the database (you could have created the column in your query …
Jump to Postdatabase1Dataset.Columns.Add(Column1);
that line is incorrect
Cannot add a column to a dataset... needdatabase1dataset.Tables["sales"].Columns.Add(Column1);
if sales was the table name
Jump to Postdo this with sql and it will save you a lot of trouble, here is a quick example assuming the table has a column called price and one called quantity
SELECT Price, Quantity, Price * Quantity AS Total FROM myTable
the server will preform the multiplication for you …
All 9 Replies
f1 fan 16 Posting Whiz in Training
barry t 0 Newbie Poster
f1 fan 16 Posting Whiz in Training
barry t 0 Newbie Poster
f1 fan 16 Posting Whiz in Training
barry t 0 Newbie Poster
plazmo 1 Posting Whiz in Training
barry t 0 Newbie Poster
plazmo 1 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.