0

many have asked a question similar to mine but my concept is different. I have a DataGrid connected to Sql where I correctly display the data. I have 2 columns Name and Price, but many names are the same and I would like to sum the price column of only the same names of the Name column. Name Price A 3 B 2 A 7 B 9

So I would like to Sum only B or A

  • can you please share some code statements? – Tanzim Siddiqee Aug 23 '22 at 09:56
  • private void button1_Click(object sender, EventArgs e) if (textBox1.Text == "") { textBox1.Text = ""; MessageBox.Show("Inserire Commessa!"); } else { this.gestionaleTableAdapter1.cercareport(this.gestionaleSQLDataSet.Gestionale, textBox1.Text, textBox2.Text); } i just use this code and the datagrid search in sql and with another button i create a report in pdf but now i need to sum some rows of the datagrid – Andy García Aug 23 '22 at 10:06
  • Actually without backend code it's hard to give solution. Please check this, might be helpful for you. https://stackoverflow.com/questions/50626375/datagridview-c-sharp-sum-of-columns – Tanzim Siddiqee Aug 23 '22 at 10:16

0 Answers0