Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using (SqlCommand command = new SqlCommand(@"SELECT * FROM @table", connection))
  2. {
  3. command.Parameters.AddWithValue("@table", table_name);
  4. using (SqlDataReader reader = command.ExecuteReader())
  5. {
  6. while (reader.Read())
  7. ...
  8. }
  9. }
  10.  
  11. using (SqlCommand command = new SqlCommand(string.Format(@"SELECT * FROM {0}",table_name), connection))
  12. {
  13. using (SqlDataReader reader = command.ExecuteReader())
  14. {
  15. while (reader.Read())
  16. ...
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement