title: On selected value from Dropdownlist update table in sql database using C#
body: <p>I put Dropdownlist inside my GridView1, and the dropdownlist has values 0 and 1. What I want is: depending on the selected value from dropDownlist to update the column [Status] whit that value in my sql database???</p>
  
  <pre><code>protected void SQL_Update(object sender, GridViewUpdateEventArgs e){
  
  SqlConnection conn = new SqlConnection();
  conn.ConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=Korisnik;Integrated Security=True";
  SqlCommand cmd = new SqlCommand();
  cmd.CommandText = "UPDATE RegistracijaKorisnik SET Status = " + ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList2")).SelectedValue; ;
  cmd.Connection = conn;
  
  conn.Open();
  cmd.ExecuteNonQuery();
  
  conn.Close();}
  </code></pre>