Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace DBAppsIntroduction
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. SqlConnection connection = new SqlConnection(
  15. "Server=(localdb)\\MSSQLLocalDB; " +
  16. "Database=SoftUni; " +
  17. "Integrated Security=true");
  18. connection.Open();
  19.  
  20. using (connection)
  21. {
  22. SqlCommand command = new SqlCommand("SELECT COUNT(*) FROM Employees", connection);
  23. var employeeCount = (int) command.ExecuteScalar();
  24. Console.WriteLine(employeeCount);
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement