2013-03-12 32 views
0

我使用此代码添加和编辑员工。首先,我正在通过验证进行检查,然后将图像添加到数据库中,如果在运行时编辑了U,则意味着错误“无法导航到'IF'”正在显示。编码有问题吗?无法导航到'IF'

private void btn_submit_Click(object sender, EventArgs e) 
{ 
    if (employeevalidate() == true) 
    { 
     toproperties(); 
     if (cpbempadd.employeesave(cpemp) == true) 
     { 
      if (saveImageInDataBase(cpemp.Empid) == true) 
      { 
       MessageBox.Show("Employee Details are Saved Sucessfully...."); 
       grid(); 
       pnl_addedit.Visible = false; 
       pnl_grid.Visible = true; 
      } 
     } 
    } 
    else 
    { 
     MessageBox.Show("Error in Saving Employee Details... "); 
    } 
} 

验证编码为:

public bool employeevalidate() 
{ 
    if (cpbempadd.textboxnull(txt_empid) == false) { return false; } 
    if (cpbempadd.textboxnull(txt_empname) == false) { return false; } 
    if (cpbempadd.textboxnull(txt_mobno) == false) { return false; } 
    if (cpbempadd.textboxnull(txt_proofdetails) == false) { return false; } 
    if (cpbempadd.textboxnull(txt_upload) == false) { return false; } 
    if (txt_add2.Text == string.Empty) { txt_add2.Text = "-"; } 
    if (txt_add3.Text == string.Empty) { txt_add3.Text = "-"; } 
    if (txt_bg.Text == string.Empty) { txt_bg.Text = "-"; } 
    if (txt_email.Text == string.Empty) { txt_email.Text = "-"; } 
    if (txt_pf.Text == string.Empty) { txt_pf.Text = "-"; } 
    if (txt_status.Text == string.Empty) { txt_status.Text = "-"; } 
    return true; 
} 
+0

你从哪里得到错误,以及你收到的实际错误信息是什么? – 2013-03-12 11:35:51

+0

@DarrenYoung @DarrenYoung如果我运行编码意味着没有错误,如果我编辑后没有发生任何错误点击提交按钮发生,所以我在这个函数中插入了一个断点,并编译它显示第一行本身错误的程序,因为无法导航到' IF'并且不会移动到下一行.. – coolprarun 2013-03-12 11:39:50

+0

您是否在按钮提交方法中放置了断点?它是否到达那里?在第一条if语句中放置一个断点,然后在断点处按F11。那是否会输入employeevalidate方法? – 2013-03-12 11:42:57

回答

0

的问题已经解决了。该错误的SQL语法不。非常感谢