FormatException
这行代码中总是有一个抛出,它说:
输入字符串的格式不正确。
这是代码:
private void btnRegister_Click(object sender, EventArgs e)
{
try
{
con.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = con;
cmd.CommandType =CommandType.Text;
cmd.CommandText = "SELECT DriverID, FirstName, LastName FROM Driver WHERE FirstName = @FirstName AND LastName = @LastName or DriverID = @DriverID";
cmd.Parameters.AddWithValue("@FirstName", MySqlDbType.VarChar).Value = txtEmployeeFN.Text;
cmd.Parameters.AddWithValue("@LastName", MySqlDbType.VarChar).Value = txtEmployeeLN.Text;
cmd.Parameters.AddWithValue("@DriverID", MySqlDbType.VarChar).Value = txtEmpID.Text;
MySqlDataAdapter adp = new MySqlDataAdapter();
adp.SelectCommand = cmd;
DataTable Mydt = new DataTable();
adp.Fill(Mydt); <===Here is the line where the exception is
con.Close();