❔ I'm trying to connect to a database from LinQ to SQL

        static void Main(string[] args)
        {
            using (var db = new CustomerDBDataContext(@"DataSource=.;Initial Catalog=northwind;Intergrated Security=True"))
            {
                var customers = db.Customers().ToList();
                foreach (var x in customers)
                {
                    Console.WriteLine(x.CompanyName);
                }
            }
        }
Was this page helpful?