private void txtDien_TextChanged(object sender, EventArgs e) { connection = new SqlConnection(db.con); if (txtDien.Text == String.Empty) { txtDien.Text = "0"; } else { DataTable dt = db.getData("select Dongia from Dichvu where MaDV ='DV001'"); double tiendien = Convert.ToDouble(txtDien.Text); double tongtien1 = 0; foreach (DataRow dr in dt.Rows) { tongtien1 += double.Parse(dr["Dongia"].ToString()) * tiendien; } txtThanhtien1.Text = tongtien1.ToString(); } }
private void refeshDataGridView(String sql) { dtgvHoadon.DataSource = db.getData(sql); }