else
  {
  Label2.Text = "失败,是否继续?";
  Button1.Visible=false;   
 reader.Close();
  }     con.Close();

解决方案 »

  1.   

    public void update_shipping_container_status()
      {
      SqlCommand mycon = new SqlCommand("update carrier set service='TTTA' where carrier='" + TextBox1.Text.ToString() + "'", con);
      mycon.ExecuteNonQuery();
      con.Close();
        
      }
    修改为:
    public void update_shipping_container_status()
      {
       con.Open();
      SqlCommand mycon = new SqlCommand("update carrier set service='TTTA' where carrier='" + TextBox1.Text.ToString() + "'", con);
      mycon.ExecuteNonQuery();
      con.Close();
        
      }