으로 옮길 때 sql 예외가 발생합니다. Visual Studio 2008을 사용하는 C# Windows 프로그램에서 작업하고 있습니다. 일반적으로 내 USB 드라이브에 직접 학교에서 일합니다. 그러나 집에서 하드 드라이브의 폴더를 복사 할 때 데이터베이스에 쓸 때마다 SQL 예외가 처리되지 않습니다. conn.Open();에서 처리되지 않았습니다. 선. 여기에는 처리되지 않은 예외가 있습니다.프로젝트를 usb에서 c :
'L : \ system \ project \ the_project \ the_project \ bin \ Debug \ PatientMonitoringDatabase.mdf'데이터베이스가 이미 있습니다. 다른 데이터베이스 이름을 선택하십시오. 'C : \ Documents and Settings \ Administrator \ My Documents \ system \ project \ the_project \ the_project \ bin \ Debug \ PatientMonitoringDatabase.mdf'파일을 데이터베이스 'PatientMonitoringDatabase'로 첨부 할 수 없습니다. 내 연결 문자열을 말한다 때문에
이, 이상해 | DataDirectory를 |이 모든 드라이브에서 작동해야하므로 ... 여기 내 연결 문자열입니다 :
string connStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\PatientMonitoringDatabase.mdf; " +
"Initial Catalog=PatientMonitoringDatabase; " +
"Integrated Security=True";
중복 질문을 게시하지 마십시오! –