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 8326261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:42:26+00:00 2026-06-09T00:42:26+00:00

I am using ASP.NET 3.5 with VB.net I have a DataTable as such. RpID

  • 0

I am using ASP.NET 3.5 with VB.net
I have a DataTable as such.

RpID       LocationServed
----       --------------
1          St. Louis
1          Baltimore
1          Columbus
2          Chicago
2          St. Charles
2          Peoria
2          Nashville
3          Dallas
3          Miami
3          Indianapolis

What that for each Rep, I need to send an email with all of their Location Served.

I am not quite sure how do do this. I am using ASP.NET 4

My plan is to have 2 loops

    <loop1 that has the group by of RepID>

     <loop2 can go through the list of items for a given RepID >

      strCity = do processing here that will compile a list of the cities for a given rep

     </loop2 end>

     <send out email a given RepID and then reset strCity >

   <loop1 end>

But not quite sure what the best approach is to tackle this.

  • 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-06-09T00:42:27+00:00Added an answer on June 9, 2026 at 12:42 am

    You can do this one of three ways.

    Assuming the DataTable is sorted by RpID, have one loop, process each city. When RpID changes, send an email.

    OR…

    Loop on the data table. When RpID changes, call .Select on the data table and filter on RpID. Loop on the returned array of DataRows and process each city. Send an email.

    OR…

    Since you are using ASP.NET 4, you can use a LINQ query to get a distinct list of RpID from the datatable, loop on that list of RpIDs, and then in the loop, use a LINQ query on the datatable to get a list of cities from the datatable for that RpID. Send an email. See here (this talks about a DataSet, but it’s the same thing, really)

    Note that for any of these approaches, you will have to have a check after the loop to send an email for the last RpID processed.

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

Sidebar

Related Questions

I'm using Asp.net chart controls in order to display charts. I have a datatable
I have a standard ASP.Net DataPager with a standard ListView (using a DataTable as
sending mail along with embedded image using asp.net I have already used following but
I'm using ASP.NET MVC and have a model which has an image (byte array)
I'm using ASP.NET and I have a string of HTML in the database. I
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on
Using ASP.Net, I have a server control for which i would like to add
Using ASP.NET VB, I have a form with some text boxes and a Gridview.
When using ASP.net webforms my usual solution would have following type of setup -

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.