Загрузка данных


using System;
using System.Data.SqlClient;

class Program
{
    static string connectionString =
        @"Server=.\SQLEXPRESS;Database=CarsDB;Trusted_Connection=True;";

    static void ReadBrands()
    {
        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            connection.Open();

            string query = "SELECT * FROM Brands";

            SqlCommand command = new SqlCommand(query, connection);
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine(
                    $"ID: {reader["Id"]}, " +
                    $"Name: {reader["Name"]}, " +
                    $"Country: {reader["Country"]}");
            }
        }
    }
}