private void mComBale_SelectedIndexChanged(object sender, EventArgs e) { try { string query1 = "SELECT baleno, SUM(mtrs) FROM tbChallan GROUP BY baleno'" + mComBale.SelectedItem.ToString() + "'"; cm = new SqlCommand(query1, con); con.Open(); dr = cm.ExecuteReader(); while (dr.Read()) { rsLblBaleTotal.Text = dr["baleno"].ToString(); } dr.Close(); con.Close(); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
syntax is I write correctly. but when I select the item from combobox then I need sum of mtrs from baleno
any correction in code??
pls help