my code is ... it is not working
i SqlCommand com = new SqlCommand("SELECT sum(amount) from custpurches where name='" + comboBox1.Text + "'", con);
try
{
con.Open();
SqlDataReader dr = com.ExecuteReader();
con.Close();
if (dr.Read())
{
label1.Text = dr["amount"].ToString();
dr.Close();
con.Close();
}
else
{
MessageBox.Show("error");
dr.Close();
con.Close();
}
}
catch (Exception ex)
{
MessageBox.Show("Try again or Refresh", "message");
}