Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys
How to multiply data of two columns for third column in datagridview in C# with ado.net -sql
command or for loop ??? I want to multiply the data (int32) of two columns and show it in the third column

thanks
Posted
Comments
Kschuler 28-May-14 15:45pm    
You could do it either way.

An easy way would be to multiply the columns in SQL

SQL
SELECT field1, field2, field1 * field2 AS field3 
FROM sometable
 
Share this answer
 
You Can use loop

C#
for(int i = 0 ; i<datagrid.rows.count mode="hold" />
  {
        int a =datagrid.rows[i][0].value;
        int b =datagrid.rows[i][1].value;

        int c = a*b;

        c=datagrid.rows[i][2].value;


  }
 
Share this answer
 
Comments
Member 10407187 29-May-14 2:21am    
Thank you:
Can you make this procedure with sql command:ado.net

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