vb.net - how can i insert into? my error is no value given for one more required parameters -
my error no value given 1 more required parameters. fields new,rev1,rev2,rev3,rev4,rev5
need convert date
.
cmd.commandtext = "insert [sheet] ([empno],[empname],[projectname],[sheetno],[title],[new],[rev1],[rev2],[rev3],[rev4],[rev5) values (empno ='" _ & txtempno.text & "',empname ='" & txtemp1.text _ & "',projectname = '" & txtpro.text & "',sheetno = '" _ & txtdrawing.text & "',title = '" & txtdesc.text _ & "', _ new = cdate('" & date1txt.text & "'), _ rev1 = cdate('" & date2txt.text & "'), _ rev2 = cdate('" & date3txt.text & "'), _ rev3 = cdate('" & date4txt.text & "'),_ rev4 = cdate('" & date5txt.text & "'), _ rev5 = cdate('" & date6txt.text & "'))"
first of @ line
[rev4],[rev5)
]
missing in [rev5]
.
second thing don't need assign parameter name here
",empname ='" & txtemp1.text & "'"
it better create parameterized query instead of concatinating string. hackers can inject sql injection in query.
values(@empno, @empname,...) or values(?, ?,...)
Comments
Post a Comment