C# how do I read an mdb(MS Access) file then pass in the retrieved columns selected in an array for later use? -
how read mdb file pass in retrieved columns selected in array? basically, trying retrieve items match 2 specified criteria columns save last column in array.
i have printed results correct per 2 criterias them being qdc , qpl when printing them how save last row later use in 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 trying use these emails (in column 5) mass bcc email chain
sean
save columns variables in while (reader.read())
loop. when reader.read() returns false, have last row values stored in variables. can whatever wish them.
update: can store values each row in list<t> object.
update 2:
// need class hold of columns in row class mydata { public string columnone { get; set; } public string columntwo { get; set; } public string columnthree { get; set; } public string columnfour { get; set; } } // list hold instances of class created above var list = new list<mydata>(); /* code connect , open reader */ while(reader.read()) { // store row var data = new mydata { columnone = reader.getstring(0), columntwo = reader.getstring(1), columnthree = reader.getstring(2), columnfour = reader.getstring(3), }; // add list list.add(data); } // can loop through list using 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(); // don't need pass in empty string }
Comments
Post a Comment