在文本框中显示查询的数据
本文关键字:查询 数据 显示 文本 | 更新日期: 2023-09-27 17:51:18
这是我的全部代码,我想选择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();
}
txtpatientid.Text = command.ExecuteScalar().ToString();