Advertisement
Guest User

Untitled

a guest
Nov 24th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  2.         {
  3.  
  4.  
  5.             //ilosc
  6.             using (SqlConnection con = new SqlConnection(polaczenieBaza))
  7.             {
  8.                 con.Open();
  9.                 try
  10.                 {
  11.                     string Sql = "select m.ilosc from produkt p join magazyn m on p.idProdukt = m.idProduktu where p.nazwaProduktu ='" + comboBox1.ToString() +"'";
  12.                     using (SqlCommand cmd = new SqlCommand(Sql, con))
  13.  
  14.                     {
  15.                         result1 = ((int)cmd.ExecuteScalar());
  16.                         label3.Text = result1.ToString();
  17.                     }
  18.                    
  19.                 }
  20.  
  21.                 catch (Exception ex)
  22.                 {
  23.                     MessageBox.Show(ex.ToString());
  24.                 }
  25.              
  26.             }
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement