471,082 Members | 855 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

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

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 1045

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.