title: C#: How to set a string as SqlParameter?
body: <p>I have a DataTable. How to set a certain value of it as one of my SqlParameters?
  I receive this error message:
  <code>The SqlParameterCollection only accepts non-null SqlParameter type objects, not String objects.</code></p>
  
  <p>Either I do:</p>
  
  <pre><code>myCommand.Parameters.Add("@managedBy");
  myCommand.Parameters["@managedBy"].Value = comp.Rows[i][4].ToString();
  
  myCommand.Parameters.Add("@modified_at");
  myCommand.Parameters["@modified_at"].Value = DateTime.Now.ToString("MM/dd/yyyy");
  
  myCommand.Parameters.Add("@cn");
  myCommand.Parameters["@cn"].Value = comp.Rows[i][1].ToString();
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>myCommand.Parameters.Add("@managedBy");
  myCommand.Parameters["@managedBy"].Value = (SqlParameter)comp.Rows[i][4];
  
  myCommand.Parameters.Add("@modified_at");
  myCommand.Parameters["@modified_at"].Value = DateTime.Now.ToString("MM/dd/yyyy");
  
  myCommand.Parameters.Add("@cn");
  myCommand.Parameters["@cn"].Value = (SqlParameter)comp.Rows[i][1];
  </code></pre>
  
  <p>What am I missing? How to set the parameter from a DataTable?</p>