app.config file in C# for SQL Server 2005 in VS 2008

后端 未结 4 1127
南旧
南旧 2021-01-20 07:03

I have C# .net project with SQL Server 2008 written in Visual Studio 2008. There I used the following connection string to connect with SQL Server:

string co         


        
4条回答
  •  长发绾君心
    2021-01-20 07:57

    Here is a sample;

    Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\PressbyranDB.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True
    

    Note that Data Source=.\SQLEXPRESS; attribute as your SQL Server and Server Instance name. Also, you do not need to restore your database from machine to machine if you use the AttachDbFilename= attribute.

提交回复
热议问题