Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6038113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:10:17+00:00 2026-05-23T06:10:17+00:00

The problem: I have a web service up and running ok, the problem I

  • 0

The problem: I have a web service up and running ok, the problem I have is that i need to return more than one instance of a class and have no real idea how to do this.

I have a loop set up in the service:

If localtab.Rows.Count > 0 Then
            Do While i <= localtab.Rows.Count
                Mbr.Urn = localtab.Rows(i).Item(0) & vbNullString
                Mbr.Title = localtab.Rows(i).Item(1) & vbNullString
                Mbr.Initials = localtab.Rows(i).Item(2) & vbNullString
                Mbr.Surname = localtab.Rows(i).Item(3) & vbNullString
                Mbr.Address1 = localtab.Rows(i).Item(4) & vbNullString
                Mbr.Address2 = localtab.Rows(i).Item(5) & vbNullString
                Mbr.Address3 = localtab.Rows(i).Item(6) & vbNullString
                Mbr.Town = localtab.Rows(i).Item(7) & vbNullString
                Mbr.County = localtab.Rows(i).Item(8) & vbNullString
                Mbr.Country = localtab.Rows(i).Item(9) & vbNullString
                Mbr.Postcode = localtab.Rows(i).Item(10) & vbNullString
                Mbr.msg = "Success"

                i = i + 1
            Loop
        Else
            Mbr.msg = "Fail - no record found"
        End If 

And i know that this works fine as it returns the last member listed in the DB. Doing something like Mbr(i).urn etc… won’t work as when I loop through i, it is only ever going to return the first instance, and once the service has returned once it will stop.

Below is the code from the client end calling the service – simple enough, all I am looking for just now is for a message box with each surname to be displayed.

Dim abMem As New ArdbegMember
    Dim retMem As ArdbegMember

    abMem.Downloaded = "N"

    Try
        cc.Open()
        retMem = cc.MbrReq(abMem)
        MesgBox(retMem.Surname)
        cc.Close()

What I need to know is how to pass a full recordset back to the client

EDIT

So based on the suggestions below, my code now looks like this –

Dim results As List(Of ArdbegMember)
            Dim i As Integer = 0

            'assign values from the table to the ArdbegMember object
            If localtab.Rows.Count > 0 Then
                Do While i <= localtab.Rows.Count
                    Mbr.Urn = localtab.Rows(i).Item(0) & vbNullString
                    Mbr.Title = localtab.Rows(i).Item(1) & vbNullString
                    Mbr.Initials = localtab.Rows(i).Item(2) & vbNullString
                    Mbr.Surname = localtab.Rows(i).Item(3) & vbNullString
                    Mbr.Address1 = localtab.Rows(i).Item(4) & vbNullString
                    Mbr.Address2 = localtab.Rows(i).Item(5) & vbNullString
                    Mbr.Address3 = localtab.Rows(i).Item(6) & vbNullString
                    Mbr.Town = localtab.Rows(i).Item(7) & vbNullString
                    Mbr.County = localtab.Rows(i).Item(8) & vbNullString
                    Mbr.Country = localtab.Rows(i).Item(9) & vbNullString
                    Mbr.Postcode = localtab.Rows(i).Item(10) & vbNullString
                    Mbr.msg = "Success"

                    i = i + 1

                    results.Add(Mbr)
                Loop
            Else
                Mbr.msg = "Fail - no record found"
            End If

            'Tidy up
            dataAdapter.Dispose()
            Cmd.Dispose()
            oConn.Close()

            'Return the ArdbegMember object
            Return results

And the error being thrown is now –

Value of type 'System.Collections.Generic.List(Of ArdbegWeb.ArdbegMember)' cannot be converted to 'ArdbegWeb.ArdbegMember'.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:10:18+00:00Added an answer on May 23, 2026 at 6:10 am

    Thanks for your help marc, the solution was blindingly obvious and i shouldn’t have missed it!

    Do While i <= localtab.Rows.Count should have read Do While i <= localtab.Rows.Count-1. The loop was repeating on itself one too many times causing issues when it was trying to return Mbr to the client side!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web service running on a JBoss server. Now I need
I have a web service app - that I need to connect to a
Here's my problem: I have to call a web service with a secure header
I have a problem with consuming a third-party web service in .NET C#. It
So I came across an interesting problem today. We have a WCF web service
I have an irritating problem, I'm creating an asp.net web service; this service should
Problem: We have a web app that calls some web services asynchronously (from the
Problem: I have to support users who need to edit web pages. Some of
As the question says, I have a problem running the web app on local
I have a web service running in IIS 6.0 on Windows 2003. It's authentication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.