别忘了close
class WinClass
{
  private SqlCommand myCmd;
  public WinClass()
  {
    myCmd = new SqlCommand();
    myCmd.CommandText = "select xm,xb,id from tbl ";
    myCmd.Connection = sqlConnection1; 
  }   private void SetInfo(string strId)   //--1
   {
    myCmd.CommandText = "select xm from tbl where id = @id";
    myCmd.Parameters.Add("@id",strId);
    myCmd.Connection.Open();
    SqlDataReader dr = myCmd.ExecuteReader();   //--2
     ...
    dr.Close();       //这里是关键
   }}