Help with nullable variables and a webmethod
Posted on 2008-10-29
I have a web methods that is set up like so
public DataSet updateAppRecord(int app_id, string app_acro, string app_name, int? app_type_id, int control_level_id, bool active)
As you can see there is one variable that is "nullable" int?
It has to be nullable because a value will not ALWAYS be passed though with this...sometimes it will be null
on the back end I call it like so
DataSet ds = almsvc.updateAppRecord(app_id.Value, app_acro, app_name, app_type_id.Value, ctl_level_id.Value, active.Value);
I ahve also tried it like so
DataSet ds = almsvc.updateAppRecord(app_id.Value, app_acro, app_name, app_type_id, ctl_level_id.Value, active.Value);
I have to beleive that the issue is occuring because of the int? for the app_type_id app_type_id.Value would be the way you woudl normally cast an int? to an int variable....but if it is int? to int? my understanding is you dont need the.Value. Why do I get a SOAP exception when I try to pass the int? variable to the web service when the web service is asking for an int? variable?