I would hazard a guess that it is the "party(name)" part of the SQL command. To check, try doing something useful with the exception:
catch (Exception ee)
{string error = ee.Message;}
That just throws it away and stops the compiler complaining - which was probably what you intended! However, it means that you can't find out what is going wrong: Try a MessageBox.Show instead, or log the error to a file.
"error is in,
n = SqlCom.ExecuteNonQuery();
what is wrong in this?"
And I am guessing that the error is "'party' is not a recognized built-in function name."?
If your column is called "party(name)" then it need to be enclosed to work. If it isn't, then you need to use the name of the column!
string qry = "insert into candidates (cand_no, cand_name, [party(name)], party_im, name_im) values (@no, @nm,@pty,@ImageData1,@ImageData2)";
Or:
string qry = "insert into candidates (cand_no, cand_name, party_name, party_im, name_im) values (@no, @nm,@pty,@ImageData1,@ImageData2)";