Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# OleDbDataReader检索特定行值(CSHTML)_C#_Html_Razor_Oledbdatareader - Fatal编程技术网

C# OleDbDataReader检索特定行值(CSHTML)

C# OleDbDataReader检索特定行值(CSHTML),c#,html,razor,oledbdatareader,C#,Html,Razor,Oledbdatareader,我试图以特定的顺序从读卡器中提取值。我有许多代表,需要将他们分组到各自的区域中,以便我可以对他们进行小计 我有一个本地mdb的连接,目前运行良好。在其他地方,我循环读卡器以获取数据。就像这样 var thisConnection = new OleDbConnection(@"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\SALES.mdb"); thisConnection.Open(); var thisCommand = t

我试图以特定的顺序从读卡器中提取值。我有许多代表,需要将他们分组到各自的区域中,以便我可以对他们进行小计

我有一个本地mdb的连接,目前运行良好。在其他地方,我循环读卡器以获取数据。就像这样

   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”],@thisReader[“xyValues\u Bud”]
}
但是我想把这些按顺序拿出来,所以让我们说。。。SouthRep、EastRep、WestRep、NorthRep

所以我需要像

@thisReader["Rep Name"] = "SouthRep" {<text>SouthRep,</text> @thisReader["xyValues_Bud "] }
@thisReader["Rep Name"] = "EastRep" {<text>EastRep,</text> @thisReader["xyValues_Bud "] }
....
@thisReader[“Rep Name”]=“SouthRep”{SouthRep,@thisReader[“xyValues\u Bud”]}
@thisReader[“Rep Name”]=“EastRep”{EastRep,@thisReader[“xyValues_-Bud”]}
....
我曾经考虑过创建一个循环,只挑选出我想要的条目,但必须有一个更简单的方法

多谢各位

@thisReader["Rep Name"] = "SouthRep" {<text>SouthRep,</text> @thisReader["xyValues_Bud "] }
@thisReader["Rep Name"] = "EastRep" {<text>EastRep,</text> @thisReader["xyValues_Bud "] }
....