连接到SQL Server数据库mdf文件错误

时间:2015-04-19 02:10:55

标签: c# database visual-studio-2010 sql-server-2008

当我部署用C#编写的Windows应用程序时,出现错误:

  

此数据库已存在

这是我的代码:

SqlConnection conn = new SqlConnection(@"Server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|direct.mdf;Trusted_Connection=Yes;Integrated Security=True;User Instance=True"); app.config :  <add name="DIRECTPERFERMANCE.Properties.Settings.directConnectionString"

connectionString="Server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\direct.mdf;Trusted_Connection=Yes;Integrated Security=True;User Instance=True"
        providerName="System.Data.SqlClient" /> </connectionStrings>

0 个答案:

没有答案