I have a SQL table that looks like this:
AAA, Amanda, Anthony
AAA, Anna, Andrew
BBB, Boris, Benji
BBB, Blondie, Bobby
I'm trying to use a SQL data reader to read the data then insert the results into a Dictionary<string, List<string[]>>
The expected result is:
[Key]
"AAA"
[Value]
"Amanda", "Anthony"
"Anna", "Andrew"
[Key]
"BBB"
[Value]
"Boris", "Benji"
"Blondie", "Bobby"
Please help:
using (SqlConnection cnn = new SqlConnection("connection"))
{
using (SqlCommand cmd = new SqlCommand("command", cnn))
{
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
... ?
}
{
{
}
Something similar to this: