1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
string s = ;
string str = "Data source = localhost;initial catalog =stock;integrated security=true";
string sql = "Select stock from produit where Nproduit = Convert.ToString( comboBox1.SelectedItem) ";
SqlConnection oCon = new SqlConnection(str);
oCon.Open();
SqlCommand oCom = new SqlCommand(sql, oCon);
SqlDataReader Dr;
Dr = oCom.ExecuteReader();
while (Dr.Read())
{
label6.Text=(Dr[0].ToString());
}
oCon.Close();
} |
Partager