-2
如何在使用C#的MS Access数据库中找不到结果时显示消息框?如何在MS Access DB中找不到结果时显示消息框?
我使用这个代码搜索:
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "SELECT * FROM Emp WHERE emp_ID LIKE '" + textBox5.Text + "'";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
slip.Text = reader["emp_ID"].ToString();
}
connection.Close();