title: How do I access Dictionary items?
body: <p>I am developing a C# VS2008 / SQL Server website app and am new to the Dictionary class.  Can you please advise on best method of accomplishing this?  Here is a code snippet:</p>
  
  <pre><code>SqlConnection conn2 = new SqlConnection(connString);
  SqlCommand cmd = conn2.CreateCommand();
  cmd.CommandText = "dbo.AppendDataCT";
  cmd.CommandType = CommandType.StoredProcedure;
  cmd.Connection = conn2;
  SqlParameter p1, p2, p3;
  foreach (string s in dt.Rows[1].ItemArray)
  {
      DataRow dr = dt.Rows[1]; // second row
      p1 = cmd.Parameters.AddWithValue((string)dic[0], (string)dr[0]);
      p1.SqlDbType = SqlDbType.VarChar;
      p2 = cmd.Parameters.AddWithValue((string)dic[1], (string)dr[1]);
      p2.SqlDbType = SqlDbType.VarChar;
      p3 = cmd.Parameters.AddWithValue((string)dic[2], (string)dr[2]);
      p3.SqlDbType = SqlDbType.VarChar;
  }
  </code></pre>
  
  <p>but this is giving me compiler error:</p>
  
  <pre><code>The best overloaded method match for 'System.Collections.Generic.Dictionary&lt;string,string&gt;.this[string]' has some invalid arguments
  </code></pre>
  
  <p>I just want to access each value from "dic" and load into these SQL parameters.  How do I do this?  Do I have to enter the key?  The keys are named "col1", "col2", etc., so not the most user-friendly.  Any other tips?  Thanks!</p>