I am developing a C# VS2008/SQL Server website application. I've never used the Dictionary class before, but I am trying to replace my Hashtable with a Dictionary variable.
Here is a portion of my aspx.cs code:
...
Dictionary<string, string> openWith = new Dictionary<string, string>();
for (int col = 0; col < headers.Length; col++)
{
@temp = (col + 1);
@tempS = @temp.ToString();
@tempT = "@col" + @temp.ToString();
...
openWith.Add(@tempT, headers[col]);
}
...
for (int r = 0; r < myInputFile.Rows.Count; r++)
{ resultLabel.Text = ADONET_methods.AppendDataCT(myInputFile, openWith); }
But this is giving me a compiler error on this last line: Argument '2': cannot convert from 'System.Collections.Generic.Dictionary' to 'string'
How do I pass the entire openWith variable to AppendDataCT? AppendDataCT is the method that calls my SQL stored proc. I want to pass in the whole row where each row has a unique set of values that I want to add to my database table. For example, if each row requires values for cells A, B, and C, then I want to pass these 3 values to AppendDataCT, where all of these values are strings. How do I do this with Dictionary?