Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 array of array

Author  Topic 

rsegecin
Yak Posting Veteran

82 Posts

Posted - 2007-07-06 : 22:32:56
Hi guys how are you doing? I'm trying to return a array of array from a web service that should return a array of objects, which I tried separately and it's working fine, a array of strings and another one made of integers, but I'm getting this message:

You must implement a default accessor on System.Array because it inherits from ICollection.

Does anyone know what could be wrong?

take a look in the code:

<%@ WebService Language="VB" Class="WebService4" %>

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace := "http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class WebService4
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function myArray() As Array
Dim myThreads As threads
Dim threadsList As New ArrayList
Dim page(0) As Integer
Dim titles(1) As String
Dim retorno(2) As Array

myThreads = New threads
myThreads.thread_id = 1
myThreads.title = "MyFirstTitle"
threadsList.Add(myThreads)

myThreads = New threads
myThreads.thread_id = 4
myThreads.title = "MySecondTitle"
threadsList.Add(myThreads)

page(0) = 0

titles(0) = "My first Title"
titles(1) = "My second Title"

retorno(0) = threadsList.ToArray(GetType(threads))
retorno(1) = page
retorno(2) = titles

Return retorno
End Function

Class threads
Public thread_id As Integer
Public title As String
End Class

End Class


Thank you very much.

rsegecin
Yak Posting Veteran

82 Posts

Posted - 2007-07-09 : 14:07:37
I solved that problem, if you wanted to know just give me a shout. Thank you for visiting my thread anyway.
Go to Top of Page
   

- Advertisement -