I have a simple SQL query (using SqlCommand, SqlTransaction) in .NET 2.0 that returns a table of integer-string pairs (ID, Name). I want to get this data into a dictionary like
i did not type this in visual studio so you might need to make minor changes to make it run...
Dictionary(int key,string value) dictionary = new Dictionary();
foreach(DataRow row in DataTable.Rows)
{
//null check??
dictionary.add(Convert.toInt(row[0]),row[1].toString());
}
try that ... see if that helps.