I have done a lot of looking around but have not found the answer yet to accomplish this. Here is some of the code:
- Web service calls an object manager which returns the ArrayList:
- ArrayList _array = ObjectManager.Instance.GetAllOrgs();
- Object manager calls the object data store returning ArrayList
- ObjectStore.Instance.GetAllOrgs();
- Object store makes database call, passes reader to method that loops over results building an Org object and adding it to an array.:
- public ArrayList GetAllOrgs()
{
ArrayList orgs = new ArrayList();
using (SqlConnection connection = new SqlConnection(_connectionString))
{
connection.Open();
SqlCommand command = new SqlCommand();
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "usp_GetOrgs";
SqlDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult);
orgs = CreateOrgs(reader);
}
return orgs;
}
Any help would be much appreciated!
I had a similar issue calling a web service from an InfoPath form.
ReplyDeleteI ended up changing the service to return a simple array of objects instead of an ArrayList.
This is the post: http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!125.entry
HTH,
--Paul Galvin
Why not use Generics to strongly type your collection?
ReplyDeleteLike so:
public List<Organization> GetAllOrgs()
{
List<Organization> orgs = new List<Organization>();
/* Load Collection */
return orgs;
}