المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Urgent need help :) Webservices



C# Programming
09-01-2009, 09:53 AM
When I call the webservice method from my class 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.


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;
}
}

[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);
}



---- Stack Trace ----
RTR.SYS_V.Setup.frm********SaveData()
frm********cs: line 0091, col 17, IL 0079
RTR.SYS_V.Setup.frm********btnSave_Click(sender As Object, e As EventArgs)
frm********cs: line 0202, col 13, IL 0001
System.Windows.Forms.Control.OnClick(e As EventArgs)
MAIN.EXE: N 00111
System.Windows.Forms.Button.OnClick(e As EventArgs)
MAIN.EXE: N 00073
System.Windows.Forms.Button.OnMouseUp(mevent As MouseEventArgs)
MAIN.EXE: N 00171
System.Windows.Forms.Control.WmMouseUp(m As Message&, button As MouseButtons, clicks As Int32)
MAIN.EXE: N 00654
System.Windows.Forms.Control.WndProc(m As Message&amphttp://www.barakasoft.com/script/Forums/Images/smiley_wink.gif
MAIN.EXE: N 8788613
System.Windows.Forms.ButtonBase.WndProc(m As Message&amphttp://www.barakasoft.com/script/Forums/Images/smiley_wink.gif
MAIN.EXE: N 8807204
System.Windows.Forms.Button.WndProc(m As Message&amphttp://www.barakasoft.com/script/Forums/Images/smiley_wink.gif
MAIN.EXE: N 00031
System.Windows.Forms.ControlNative********OnMessage(m As Message&amphttp://www.barakasoft.com/script/Forums/Images/smiley_wink.gif
MAIN.EXE: N 00015
System.Windows.Forms.ControlNative********WndProc(m As Message&amphttp://www.barakasoft.com/script/Forums/Images/smiley_wink.gif
MAIN.EXE: N 00048
System.Windows.Forms.Native********Callback(hWnd As IntPtr, msg As Int32, wparam As IntPtr, lparam As IntPtr)
MAIN.EXE: N 00089