B
Boffo Jinko
This should be obvious, but I can't figure it out...
I have the following web service:
<WebMethod (Description:="Returns a dataset of all people from the
database.")> _
Public Function GetAllPeople() As DataSet
Dim objConn As New OleDbConnection(Application("dbString"))
Dim cmd As New OleDbCommand("persondata.all_people", objConn)
cmd.CommandType = CommandType.StoredProcedure
Dim da As New OleDbDataAdapter(cmd)
Dim dsTemp As New DataSet
objConn.Open()
da.Fill(dsTemp, "AllJudges")
Return dsTemp
End Function
From an ASP.NET project, I have referenced the web service and have declared
it.
Private objPeopleService As MyService.Service1
...
objPeopleService = New MyService.Service1
Dim objDs As DataSet = objPeopleService.GetAllPeople
Response.Write("<br>Count is " &
objDs.Tables("Exchanges").Rows.Count)
The Reponse.Write() line gives an error: Object reference not set to an
instance of an object
If I call a WebMethod that returns an integer, it returns fine. I created a
test WebMethod that gets a DataSet and then returns the count from the
WebMethod, as opposed to passing the DataSet back to the client, and it
returns the count just fine. So it looks like I am doing something wrong
either in the WebMethod Return statement or in assigning the DataSet a value
in the client. Any ideas about what the problem is?
Thank you!
Scott
I have the following web service:
<WebMethod (Description:="Returns a dataset of all people from the
database.")> _
Public Function GetAllPeople() As DataSet
Dim objConn As New OleDbConnection(Application("dbString"))
Dim cmd As New OleDbCommand("persondata.all_people", objConn)
cmd.CommandType = CommandType.StoredProcedure
Dim da As New OleDbDataAdapter(cmd)
Dim dsTemp As New DataSet
objConn.Open()
da.Fill(dsTemp, "AllJudges")
Return dsTemp
End Function
From an ASP.NET project, I have referenced the web service and have declared
it.
Private objPeopleService As MyService.Service1
...
objPeopleService = New MyService.Service1
Dim objDs As DataSet = objPeopleService.GetAllPeople
Response.Write("<br>Count is " &
objDs.Tables("Exchanges").Rows.Count)
The Reponse.Write() line gives an error: Object reference not set to an
instance of an object
If I call a WebMethod that returns an integer, it returns fine. I created a
test WebMethod that gets a DataSet and then returns the count from the
WebMethod, as opposed to passing the DataSet back to the client, and it
returns the count just fine. So it looks like I am doing something wrong
either in the WebMethod Return statement or in assigning the DataSet a value
in the client. Any ideas about what the problem is?
Thank you!
Scott