Guest User

Untitled

a guest
Jun 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. string _connectionString = ("server=vrsbase-w2k3;" +
  4. "database=express;" +
  5. "user=sa;" +
  6. "password=");
  7.  
  8. string _sql = string.Empty;
  9.  
  10. SqlConnection conn = null;
  11.  
  12. // 2. Create and open a connection object
  13.  
  14. conn = new SqlConnection(_connectionString);
  15.  
  16. // 3. Open the Connection
  17.  
  18. conn.Open();
  19.  
  20.  
  21. for (int x = 1; x <= 50000; x++)
  22. {
  23. _sql =
  24. string.Format(
  25. @"INSERT INTO dbo.airway (number, name) VALUES ('{0}', 'Bobby Lee');", x);
  26.  
  27. SqlCommand command = new SqlCommand(_sql, conn);
  28.  
  29. string returnvalue = (string) command.ExecuteScalar();
  30.  
  31. Console.WriteLine(string.Format("Writting record {0} -> Value ({1})", x, returnvalue));
  32. }
  33. conn.Close();
  34. }
Add Comment
Please, Sign In to add comment