Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
In my c# window application,get data using Stored procedure and bind datagridview but some fields calculated on runtime which is not available in database. So please help to add calculated field in datagridview or add from stored procedure.
Posted

you can create a field in your sp query that is the result of 2 or more columns in your select like
SQL
select artno, artname, nrOrdered, price, (nrOrdered * price) [OrderlinePriceTotalValue]
from TableWithGoods
 
Share this answer
 
You can create calculated columns in your query and give them an alias, and then you will be able to access these columns like regular columns.
SQL
SELECT Quantity, UnitRate, Tax, ((Quantity * UnitRate) + Tax) AS LineAmount
FROM OrderDetails
WHERE OrderID = @OrderID
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900