Connecting to local SQL Server database using C#

前端 未结 6 1882
后悔当初
后悔当初 2020-12-17 16:53

Suppose I have created a SQL Server database called Database1.mdf in the App_Data folder in Visual Studio with a table called Names. <

6条回答
  •  余生分开走
    2020-12-17 16:55

    You try with this string connection

    Server=.\SQLExpress;AttachDbFilename=|DataDirectory|Database1.mdf;Database=dbname; Trusted_Connection=Yes;
    

提交回复
热议问题