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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:34:47+00:00 2026-05-23T22:34:47+00:00

How do I read an mdb file then pass in the retrieved columns selected

  • 0

How do I read an mdb file then pass in the retrieved columns selected in an array? Basically, I am trying to retrieve items that match 2 specified criteria columns that then save the last column in an array.

I have the printed results correct as per the two criterias them being qDC and qPL but now when printing them how do I save the last row for later use in an array.

var list = new List<MyData>();
   while (true)
   {
      while (reader.Read())
      {
          var data = new MyData
           {
              ColumnOne = reader.GetString(0),
              ColumnTwo = reader.GetString(1),
              ColumnThree = reader.GetString(2),
              ColumnFour = reader.GetString(3),
              ColumnFive = reader.GetString(4),
            };
           list.Add(data);

           Console.WriteLine("");
           foreach (var row in list)
           {
             Console.WriteLine("Start Here");
             Console.WriteLine(row.ColumnOne); 
             Console.WriteLine(row.ColumnTwo); 
             Console.WriteLine(row.ColumnThree); 
             Console.WriteLine(row.ColumnFour); 
             Console.WriteLine(row.ColumnFive);//Email
             Console.WriteLine(""); 
           }

I am trying to use these emails (in column 5) as a mass bcc email chain

Sean

  • 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-23T22:34:48+00:00Added an answer on May 23, 2026 at 10:34 pm

    save the columns to variables in your while (reader.Read()) loop. when reader.Read() returns false, you will have the last row values stored in the variables. Then you can do whatever you wish with them.

    Update:
    you can store values from each row in a List<T> object.

    Update 2:

    // you need a class to hold all of the columns in a row
    class MyData {
      public string ColumnOne { get; set; }
      public string ColumnTwo { get; set; }
      public string ColumnThree { get; set; }
      public string ColumnFour { get; set; }
    }
    
    
    // list to hold instances of the class created above
    var list = new List<MyData>();
    /* code to connect and open reader */
    while(reader.Read()) {
      // store your row
      var data = new MyData {
        ColumnOne = reader.GetString(0),
        ColumnTwo = reader.GetString(1),
        ColumnThree = reader.GetString(2),
        ColumnFour = reader.GetString(3),
      };
      // add it to the list
      list.Add(data);
    }
    // you can loop through the list using a foreach loop
    foreach(var row in list) {
      Console.WriteLine("Start Here");
      Console.WriteLine(row.ColumnOne);
      Console.WriteLine(row.ColumnTwo);
      Console.WriteLine(row.ColumnThree);
      Console.WriteLine(row.ColumnFour);
      Console.WriteLine(); // you don't need to pass in an empty string
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using vb6 and trying to read an mdb file into a Set
Is there an easy way to read an entire Access file (.mdb) into a
I am writing an application in C# that reads info from a .mdb file
I'm trying to read data stored in a ms access database that generated by
I read values from an local Access mdb-file. One value is stored as string
I have an application uploading Access MDB (its file format) that I need to
I am tring to find someway to read from local MDB file. It is
I would like to know if it's possible to read a .mdb file without
I read somewhere once that the modulus operator is inefficient on small embedded devices
I read in this article that a company has created a software capable of

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.