468,537 Members | 1,480 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

WebMethod and DataSet

Everytime I call the method below I get the following exception in a
vb.net app:

'Unable to cast object of type 'System.Xml.XmlNode[]' to type
'System.Data.DataSet'

I was able to get the same code to work with a dataset that only
returned one row but with multiple rows (guessing that's where the
Node[] comes in) it doesn't work. Anyone have any suggestions?

<WebMethod(Description:="Get Open Service Tickets")_
Public Function OpenServiceTickets() As DataSet

Dim adapter As SqlDataAdapter
Dim result As New DataSet
Dim cnn As String
Dim query As String
query = "Select ....'"
cnn = "Data Source=...."
adapter = New SqlDataAdapter(query, cnn)
adapter.Fill(result, "Service")

Return result

End Function
Thanks for any help.

This is the client code I'm using:

Dim ws As New WebReference.WebService()
Dim dsConsumables As New DataSet
Dim dtConsumables As New DataTable
Dim dsService As New DataSet
Dim dtService As New DataTable

dsConsumables = ws.OpenConsumOrders()
dsService = ws.OpenServiceTickets()

dtConsumables = dsConsumables.Tables(0)
dtService = dsService.Tables(0)

Me.dgConsumables.DataSource = dtConsumables
Me.dgServiceTickets.DataSource = dtService

Jun 15 '07 #1
0 1000

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Temp | last post: by
6 posts views Thread by rlcavebmg | last post: by
1 post views Thread by Inas Hafez | last post: by
5 posts views Thread by John | last post: by
3 posts views Thread by Khurram | last post: by
reply views Thread by Rob | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.