Sev M

Sev M

  • NA
  • 4
  • 0

Webservices Null Reference Exception??

Aug 31 2009 7:43 AM

I have 2 webservice methods Load Window and Save Window.
When I call the webservice method from my form synchronously or assynchronously i am receiving the following error:


(System.NullReferenceException: Object reference not set to an instance)

I am being able to call the loadWindow webservice method without any problem but when i pass the dataset as parameter in the saveWindow im receiving the error above. Any solution will be appreciated. Smile

<pre>
//form
private void SaveData()
{
try
{
SYS_WS sysws = new SYS_WS();
sysws.SaveWindowCompleted +=new SaveWindowCompletedEventHandler(sysws_SaveWindowCompleted);
sysws.SaveWindowAsync((SYSDataset)dsSystem.GetChanges());
}
catch (Exception ex)
{
throw (ex);
}
}

private void sysws_SaveWindowCompleted(object sender,
SaveWindowCompletedEventArgs e)
{
try
{
if (e.Error != null)
{
return;
}
this.dsSystem.AcceptChanges();

}
catch (Exception ex)
{
throw ex;
}
}




//Webservices

[WebMethod(EnableSession = true)]
public bool SaveWindow(SYSDataset ds)
{
try
{
WindowController cont = new WindowController();
cont.SaveWindows(ds);
return true;
}
catch (Exception ex)
{
throw (ex);
}
}


[WebMethod(EnableSession = true)]
public SYSDataset LoadWindow(string WindowID)
{
WindowController cont = new WindowController();
return cont.LoadWindow(WindowID);
}
</pre>

Answers (2)