我有一个如下所示的 SQL 表:
AAA, Amanda, Anthony
AAA, Anna, Andrew
BBB, Boris, Benji
BBB, Blondie, Bobby
我正在尝试使用 SQL 数据阅读器来读取数据,然后将结果插入到Dictionary<string, List<string[]>>
预期结果是:
[Key]
"AAA"
[Value]
"Amanda", "Anthony"
"Anna", "Andrew"
[Key]
"BBB"
[Value]
"Boris", "Benji"
"Blondie", "Bobby"
请帮忙:
using (SqlConnection cnn = new SqlConnection("connection"))
{
using (SqlCommand cmd = new SqlCommand("command", cnn))
{
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
... ?
}
{
{
}