How to Connect to SQL Server using LINQ to SQL?

后端 未结 3 1394
时光取名叫无心
时光取名叫无心 2021-01-31 10:04

Sure this is a really dumb question, but how do I connect my C# console app to a SQL Server Instance?

Have done this plenty of times with c# Web Apps, but this is the fi

3条回答
  •  离开以前
    2021-01-31 10:24

    When you've created your console application, in the Solution Explorer, choose Add New Item and you should get a dialog box something like this:

    enter image description here

    What you're looking for is the Linq-to-SQL Classes which creates a *.dbml model file.

    For a very complete and thorough introduction to Linq-to-SQL, read Scott Guthrie's Using Linq to SQL blog series (many posts). Those things all apply to any kind of app using Linq-to-SQL to talk to SQL Server.

提交回复
热议问题