我有一个用于编辑数据的表单,当我选择一个ID时,它会在我的textboxes
中显示一些数据,我还想在我的position_edit
中显示一些数据组合框。
到目前为止,这是我的代码:
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
String query = "SELECT * FROM emp WHERE ID = '" + id_edit.Text + "'";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
name_edit.Text = reader["Name"].ToString();
dob_edit.Text = reader["DOB"].ToString();
position_edit.Items.Add ??
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
connection.Close();
}
感谢。