这段代码跳到 else 语句上

问题描述

if (EmployeeID > 0)   
{
    sqlCommand cmd = new sqlCommand("UPDATE EmployeeInfo SET EmpName = @EmpName,Department = @Department,Designation = @Designation WHERE EID = @ID ",con);
    cmd.CommandType = CommandType.Text;
    cmd.Parameters.AddWithValue("@EID",txtEmpID.Text);
    cmd.Parameters.AddWithValue("@EmpName",txtEmpName.Text);
    cmd.Parameters.AddWithValue("@Department",txtDepart.Text);
    cmd.Parameters.AddWithValue("@Designation ",txtDesign.Text);
    cmd.Parameters.AddWithValue("@ID",this.EmployeeID);

    con.open();
    cmd.ExecuteNonQuery();
    con.Close();

    MessageBox.Show(
        "Employee information is updated successfully","Saved",MessageBoxButtons.OK,MessageBoxIcon.information);

    getemployeerecords();
    resetfunction();
}
else 
{
    MessageBox.Show(
        "Please select employee to update","Select",MessageBoxIcon.Error);
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)