Prakash Mondal

Prakash Mondal

  • NA
  • 288
  • 209k

How to add column in dataGridView with calculation?

Apr 5 2018 5:05 AM
I load a dataGridview using DataTable.
suppose:
public void loadGrid()
{
con.open();
SqlDataAdapter da= new SqlDataAdapter ("SELECT * FROM COMMISION_TB",con);
DataTable dt = new DataTable();
da.Fill(dt);
con.close();
dataGridview.AutogeneratedColumn=false;
dataGridview1.DataSource=dt; 
}// I wite this code in notepad
Like that...
 Empno Name Dept Basic Salary
 Commision (%)
Status
 E123 Priya EC 32500 2Paid
 E124 Riya EN 20800 3.5Paid
 E125 Jiya GG 29500 1.5Paid
 
I want to display the total paid amount (basic salary+(basic salary * commission) ) in this gridview as column, that is
 
 
 Empno Name Dept Basic Salary
 Commision (%)
Total Amount
Status
 E123 Priya EC 32500 233150
Paid
 E124 Riya EN 20800 3.521528
Paid
 E125 Jiya GG 29500 1.529942.5
Paid
Please give me solution.

Answers (5)