Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DBAppsIntroduction
- {
- class Program
- {
- static void Main(string[] args)
- {
- SqlConnection connection = new SqlConnection(
- "Server=(localdb)\\MSSQLLocalDB; " +
- "Database=SoftUni; " +
- "Integrated Security=true");
- connection.Open();
- using (connection)
- {
- SqlCommand command = new SqlCommand("SELECT COUNT(*) FROM Employees", connection);
- var employeeCount = (int) command.ExecuteScalar();
- Console.WriteLine(employeeCount);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement