Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public static DataTable SqlDataTable(string sql, IDictionary<string, object> values)
  2. {
  3. using (SqlConnection conn = new SqlConnection(GetConnectionString))
  4. using (SqlCommand cmd = new SqlCommand(sql, conn))
  5. {
  6. conn.Open();
  7.  
  8. foreach (var item in values)
  9. {
  10. cmd.Parameters.AddWithvalue("@" + item.Key, item.Value); // error
  11. }
  12. .......
  13. ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement