2010-03-19 4 views
0

메신저 코드를 사용하여 서버 PC의 데이터베이스에서 파일을 복사합니다. 그래서 그 서버에 IP 주소를 통해 액세스하지만 그것은 내 오류를주고 내 PC (클라이언트 PC)의 폴더에있는 파일을 복사하지 않는 내 사용하는 코드는 ... 내가 어디서 잘못 말할 수 있습니까 ??네트워크 액세스 서버에서 .net의 클라이언트 PC로 데이터베이스 파일을 복사하는 방법은 무엇입니까?

파일 경로의 WinForm 내 목록보기에 기재되어 있습니다 ..

버튼 클릭 이벤트에
public string RecordingFileCopy(string recordpath,string ipadd) 
{ 
    string strFinalPath; 
    strFinalPath = String.Format("\\{0}'{1}'",ipadd,recordpath); 
    return strFinalPath; 
} 

....

{ 
     try 
     { 

      foreach (ListViewItem item in listView1.Items) 
      { 
       string sourceFile = item.SubItems[5].Text; 
       RecordingFileCopy(sourceFile,"10.0.4.123"); 
       File.Copy(sourceFile, Path.Combine(@"E:\name\MyDir", Path.GetFileName(sourceFile))); 
      } 

     } 
     catch 
     { 
      MessageBox.Show("Files are not copied to folder", _strMsg, MessageBoxButtons.OK, MessageBoxIcon.Error); 
     } 
    } 
+0

throw되는 예외를 지정하십시오. catch (Exception ex) -> print that – TimothyP

답변

0

을 데이터베이스가 현재 데이터베이스 서버에 연결되어있는 경우, 예 SQL Server가 복사하려는 .mdf 파일에 첨부 된 다음 파일이 잠겨서 복사 할 수 없습니다. 먼저 대상 데이터베이스에서 분리해야합니다.

관련 문제