Click here to Skip to main content
15,915,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
SqlCommand cmd = new SqlCommand("insert into TTBL(TRAID, CLINT, TRASD, OPBAL, CLBAL, TDATE, TTIME, CBY, AMOUT, AWORD, PMODE, GSLGR, GMLGR, GLGRD, CPRSN, VCHNO, RECNO) 
values (" + txtTRANSACTIONID.Text + ", '" + Session["client_id"].ToString() + "', '" + selectitemCD + "', " + txtOPENBAL.Text + ", " + txtCLOSEBAL.Text + ", '" + txtNormalDate.Text + "', '" + txtTime.Text + "', '" + txtCreatedBy.Text + "'," + txtAMOUNT.Text + ", '" + txtPAYINWORD.Text + "', '" + selectitemCC + "','" + ddlSub.Text + "', '" + ddlMain.Text + "', '" + txtGLDESCRIPTION.Text + "', '" + txtConsernPerson.Text + "'," + txtVOCHERNO.Text + ", " + txtRECEIPTNO.Text + " )", cn);
Posted
Updated 2-Apr-14 0:33am
v2
Comments
Bernhard Hiller 2-Apr-14 8:24am    
Get rid of string concatenation, use a parameterized query instead.
If it throws that exception also, you'll be able to see the line and thus the "missing" value.

You need to add breakpoint on this like or use try catch to know which variable/control is throwing this error. Only then we can fix it.
 
Share this answer
 
Possible candidates to throw this error Session["client_id"].ToString() , selectitemCD, selectitemCC. Check they are not null.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900