title: suppose i have max(pid)=1001 if i want to display values of 1002 which is through +1 into max value so how can i do
body: <p>suppose i have <code>max(pid)=1001</code> if i want to display values of 1002 which is through +1 into max value so how can i do </p>
  
  <p>This is my entire code i want to select max(pid) and want to display that into textbox</p>
  
  <pre><code>public PatientRegistration()
      {
          InitializeComponent();
          string connectionstring = "DATABASE=hmanagmentsystem;UID=root;PASSWORD=;SERVER=localhost";
          con = new MySqlConnection(connectionstring);
          con.Open();
      }
  
    private void PatientRegistration_Load(object sender, EventArgs e)
      {
  
          MySqlCommand command = new MySqlCommand("select max(pid) from patientreg",con);
          int cmd=Int32.Parse(command.ExecuteScalar().ToString());
          con.Close();
  
      }
  </code></pre>