Parameter Placeholders are causing an error in Webmatrix -
every time try using parameter placeholders either in select, insert, or update statement in webmatrix same error. works fine in clause. doing wrong need help.
here code:
if (ispost && validation.isvalid()) { admission1 = request["admdate1"]; discharge1 = request["disdate1"]; loc1 = request["loc1"]; program1 = request["programname1"]; notes = request["notes"]; var sqlupdate = "update ssi_screening_new set admissiondate1=@49, dischargedate1=@50, loc1=@51, programname1=@52, notes1=@53 (id) = (@0)"; db.execute(sqlupdate, admission1, discharge1, loc1, program1, notes, ssid); if (modelstate.isvalid) { response.redirect("~/thankyou"); } } is there alternative using parameter placeholders in webmatrix?
here error every time:
exception details: system.data.sqlclient.sqlexception: must declare scalar variable "@49".
thanks in advance help!
you on right track, must start parameter placeholders @ @0, @1, @2, @3... , forth. can't jump @49, why it's saying must declare variable. try using @0 thru @5 , work.
var sqlupdate = "update ssi_screening_new set admissiondate1=@0, dischargedate1=@1, loc1=@2, programname1=@3, notes1=@4 (id) = (@5)";
Comments
Post a Comment