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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:41:14+00:00 2026-06-06T11:41:14+00:00

I have a nice dataset loop working, but I need to run another loop

  • 0

I have a nice dataset loop working, but I need to run another loop based on an ID in the parent loop.

I set up a generic list in a separate class, but I’m totally stumped on how to actually call it. I’ve Googled it but can’t find an example I understand.

EDIT:

List Code…

public class BinList
{
    public static List<Bin> GetById(int binOrderSiteID)
    {
        List<Bin> bins = new List<Bin>();

        SqlConnection conn;
        SqlCommand comm;
        SqlDataReader reader;

        using (conn = new SqlConnection(myConnectionHere))
        {
            comm = new SqlCommand("dbo.sl_BinsBySite", conn);
            comm.CommandType = CommandType.StoredProcedure;
            comm.Parameters.Add(new SqlParameter("@binOrderSiteID", SqlDbType.Int));
            comm.Parameters["@binOrderSiteID"].Value = binOrderSiteID;

            try
            {
                conn.Open();
                reader = comm.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        Bin b = new Bin();
                        b.BinQty = reader["binQty"].ToString();
                        b.BinType = reader["binType"].ToString();
                        b.BinWasteGroupName = reader["binWasteGroupName"].ToString();
                        b.BinCollectionFrequencyType = reader["binCollectionFrequencyType"].ToString();
                        b.BinDeliveryStartDate = reader["binDeliveryStartDate"].ToString();
                        b.BinEmptyCharge = reader["binEmptyCharge"].ToString();
                        b.BinRentalCharge = reader["binRentalCharge"].ToString();
                        b.BinDutyOfCareCharge = reader["binDutyOfCareCharge"].ToString();
                        b.BinDeliveryCharge = reader["binDeliveryCharge"].ToString();
                        bins.Add(b);
                    }
                }
            }

            finally
            {
                conn.Close();
            }
        }

        return bins;
    }
}

This is a repository for each field

public class Bin
    {
        public string BinQty { get; set; }
        public string BinType { get; set; }
        public string BinWasteGroupName { get; set; }
        public string BinCollectionFrequencyType { get; set; }
        public string BinDeliveryStartDate { get; set; }
        public string BinEmptyCharge { get; set; }
        public string BinRentalCharge { get; set; }
        public string BinDutyOfCareCharge { get; set; }
        public string BinDeliveryCharge { get; set; }
    }

Code to that calls the loops

public class PDFCreator
{
    public static int BinOrderID { get; set; }

    private int binOrderID = 0;

    public PDFCreator(int intBinOrderID)
    {

    //Lots of code here

    //Data conenection/datatable code here

    foreach (DataRow row in dt.Rows)
            {
                //lots of code here

                //dont know how to connect up or call the List

                something?? = BinList.GetById(Convert.ToInt32(row["binOrderSiteID"].ToString()));

                foreach (//somnething here)
            }   
    }
}

Sorry I didn’t add my code initially. I didn’t want to show it cos I thought it was pants.

Any ideas?

Cheers,
Numb

  • 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-06T11:41:16+00:00Added an answer on June 6, 2026 at 11:41 am

    To call BinList GetById

    var binList = BinList.GetById((int)row["binOrderSiteID"]);
    
    foreach (var bin in binList)
    {  
        // do what you need to do with bin variable
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nice page that does everything I need. However one of the
I have this nice little MSBuild-based daily build setup that I use on my
Site that have nice but raising number of visits / hits, heavily operates on
I am targeting 1.6 but I would like to have nice widget that can
I have a nice DataGridView showing what is basically some kind of log data
I have a nice interface, and I want to implement one member of it
Does anyone have a nice solution for GalleryView when I want to display photos
So I have this nice spiffy MVC-architected application in Java Swing, and now I
Imagine that I have a nice Deck class, in the best OO fashion. It
Say I have a nice domain model, using (constructor) DI where needed. Now I

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.