How to Connect to SQL Server using LINQ to SQL?

后端 未结 3 1471
时光取名叫无心
时光取名叫无心 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:25

    It sounds like you want to create a new LINQ To SQL dbml to your console app, and use Visual Studio's Server Explorer as part of the process.

    Add a .dbml to your project as per normal.

    Your Server Explorer window in Visual Studio should allow you to create a new Connection. Ensure you're using SqlClient. Here you can enter the instance name of your SQL Server.

    enter image description here

提交回复
热议问题