假设我有max(pid)=1001
,如果我想显示 1002 的值,它通过 +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);
int cmd=Int32.Parse(command.ExecuteScalar().ToString());
con.Close();
}