I have 3 projects working fine separately but now I need to combine them in one file and I did it. Now I'm facing problem at the time of sending email after executing the query. Query works fine and there is no problem. I could't understand where is the problem in my code?
HiddenField tada = (HiddenField)item.FindControl("tada");
if (tada.Value == "4")
{
// approved
oda2.UpdateCommand.CommandText = @"update kamran.crp_mov_ord
set sta_flg=15, rnd_cod='" + appcode +@"'
where mor_num='" + item["mor_num"].Text + "'";
if (oda2.UpdateCommand.ExecuteNonQuery() > 0)
{
dsMove.Tables["dirdata"].Rows.Add(new object[] { item["mor_num"].Text, item["emp_nom"].Text, item["dsg_des"].Text, item["dpt_des"].Text, item["dst"].Text, item["pur_dty"].Text, item["sty_frm"].Text, item["sty_too"].Text, "Director Approved", comment, appcode });
}
}
else
{
// approved
oda2.UpdateCommand.CommandText = @"update kamran.crp_mov_ord
set sta_flg=2, rnd_cod='" + appcode +@"'
where mor_num='" + item["mor_num"].Text + "'";
if (oda2.UpdateCommand.ExecuteNonQuery() > 0)
{
dsMove.Tables["dirdata"].Rows.Add(new object[] {tem["mor_num"].Text, item["emp_nom"].Text, item["dsg_des"].Text, item["dpt_des"].Text, item["dst"].Text, item["pur_dty"].Text, item["sty_frm"].Text, item["sty_too"].Text, "Director Approved", comment, appcode });
}
I am getting NullReferenceException in IF condition after executing the query.