|
Поиск смотрел или как?
Там один из первых результатов выдаёт такой код:
SqlConnection conn = new SqlConnection("server=(local)\\SQLEXPRESS;database=MyDatabase;Integrat ed Security=SSPI;");
string sql = @"select count(*) from employee";
SqlCommand cmd = new SqlCommand(sql, conn);
Console.WriteLine("Command created and connected.");
try
{
conn.Open();
Console.WriteLine("Number of Employees is {0}", cmd.ExecuteScalar());
}
|