I'm trying to pull values out of a reader in a particular order. I have a number of reps and need to group them together into their regions so I can sub total them.
I have a connection to a local mdb, which works fine for the time being. And in other places I loop the reader to get data out. Like so...
var thisConnection = new OleDbConnection(@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\SALES.mdb");
thisConnection.Open();
var thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT `Rep Name`, Sum(`Budget`) AS xyValues_Bud FROM `Invoices` GROUP BY `Rep Name`;";
OleDbDataReader thisReader = thisCommand.ExecuteReader();
.....
@while(thisReader.Read())
{
@thisReader["Rep Name"] <text>,</text> @thisReader["xyValues_Bud "]
}
However I want to pull these out in an order so lets say... SouthRep, EastRep, WestRep, NorthRep
So I need something like...
@thisReader["Rep Name"] = "SouthRep" {<text>SouthRep,</text> @thisReader["xyValues_Bud "] }
@thisReader["Rep Name"] = "EastRep" {<text>EastRep,</text> @thisReader["xyValues_Bud "] }
....
I've thought about creating a loop and just picking out the entries I want but there must be a simpler way.
Thank you