1

これは、max(pid) を選択し、それをテキスト ボックスに表示したい私のコード全体です。

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);
        txtpatientid.Text = command.ToString();
        con.Close();

    }
4

1 に答える 1

2
txtpatientid.Text = command.ExecuteScalar().ToString();
于 2013-01-09T22:01:46.577 に答える