c# - AddWithValue contains # that needs to be " " -
i have sql update statement inside update_ckick event:
dim tmp_date date dim yeardatetime new nullable(of date) if date.tryparse(txtstartdate.text, tmp_date) yeardatetime = tmp_date else yeardatetime = nothing end if
update details set emp_dateappointedrank = @emp_dateappointedrank
updateemp.parameters.addwithvalue("emp_dateappointedrank", string2date(yeardatetime))
that's snippet, happens when step line update details set emp_dateappointedrank = @emp_dateappointedrank
value shows #10/03/2014#
how can make value just: 10/03/2014
no #?
c# welcome
i suspect mistaking what's being displayed visual studio debugger means.
#10/03/2014#
date
literal in vb.net. means it's type date
(datetime
in c#) , it's value 10/03/2014
.
apart that, have prepend @
in sql-parameter if use ms-sql-server , date
variable instead of string
:
if yeardatetime.hasvalue updateemp.parameters.addwithvalue("@emp_dateappointedrank", yeardatetime.value) else updateemp.parameters.addwithvalue("@emp_dateappointedrank", dbnull.value) end if
Comments
Post a Comment