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
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: