2011-09-19 8 views
0

SQL 연결에 문제가 있습니다. 이 내 코드SQL 연결을 만들 수 없습니다.

private static SqlConnection GetConnection() 
{ 
    SqlConnection con = new SqlConnection(); 
    con.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=" + path + @"\App_Data\Database1.sdf;Integrated Security=True;User Instance=True"; 
    con.Open(); 

    return con; 
} 

이며,이 내가

Error: An attempt to attach an auto-named database for file \App_Data\Database1.sdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

을 얻을 것입니다 그리고 내 데이터베이스 폴더 App_Data에 위치 확신하지 무슨 잘못

+2

경로의 값은 무엇입니까? – Mark

+0

"path"변수에는 무엇이 들어 있습니까? –

답변

0

이 당신이 직면하고있는 문제를 다룰 수 ... 링크 BU에 대한

msdn on sql express

죄송합니다 나는 누군가 elses 결과를 붙여 넣기를 복사하고 싶지 않았습니다 ...

관련 문제