R
raheel hussain
hi
i got a problem here in returning a Dataset from a webservice.
following is my code
in webservice
------------------------
<WebMethod()> _
Public Function GetDS(ByVal str As String) As System.Data.DataSet
'code here
cn.Open() 'connection object
Dim cmd As New SqlCommand
cmd.Connection = cn
cmd.CommandType = System.Data.CommandType.Text
Dim ds As New System.Data.DataSet
Dim da As New SqlDataAdapter(cmd)
da.SelectCommand = cmd
cmd.CommandText = "select * from Emp where sName='"&str&"'"
da.Fill(ds, "tblVehicle")
return ds
End Function
and here how i m calling it
-----------------------------
Dim ds As System.Data.DataSet
ds = objWebService.GetDS("test")
I also tried calling it as
-----------------------------
Dim ds As System.Data.DataSet=objWebService.GetDS("test")
things to note here is
- when i run the webservie in debug mode (through http://localhost/myservice.asmx)
this functions works fine and return the dataset as xml document.
- when i copy the function in my consumer application (the asp.net web application)
it works fine as a local function and returns dataset.
- but when i call it through my consumer web application through the webservice obj
it gives me the following error :
"object reference not set to an instance of object."
I require the help of you guys to sort out this.
With Best Regards
Raheel Hussain
___
Newsgroups brought to you courtesy of www.dotnetjohn.com
i got a problem here in returning a Dataset from a webservice.
following is my code
in webservice
------------------------
<WebMethod()> _
Public Function GetDS(ByVal str As String) As System.Data.DataSet
'code here
cn.Open() 'connection object
Dim cmd As New SqlCommand
cmd.Connection = cn
cmd.CommandType = System.Data.CommandType.Text
Dim ds As New System.Data.DataSet
Dim da As New SqlDataAdapter(cmd)
da.SelectCommand = cmd
cmd.CommandText = "select * from Emp where sName='"&str&"'"
da.Fill(ds, "tblVehicle")
return ds
End Function
and here how i m calling it
-----------------------------
Dim ds As System.Data.DataSet
ds = objWebService.GetDS("test")
I also tried calling it as
-----------------------------
Dim ds As System.Data.DataSet=objWebService.GetDS("test")
things to note here is
- when i run the webservie in debug mode (through http://localhost/myservice.asmx)
this functions works fine and return the dataset as xml document.
- when i copy the function in my consumer application (the asp.net web application)
it works fine as a local function and returns dataset.
- but when i call it through my consumer web application through the webservice obj
it gives me the following error :
"object reference not set to an instance of object."
I require the help of you guys to sort out this.
With Best Regards
Raheel Hussain
___
Newsgroups brought to you courtesy of www.dotnetjohn.com