2013-03-25 1 views
1

ive 원격 파일을 읽으려고 sqlite를 얻으려고했으나이 파일에 대한 해결책이 없다는 사실을 플랫 파일에 알려줍니다. 여기 URL을 사용하여 원격 파일에 연결하는 Sqlite C#

내가 얻을

public void Run(string sql,string check,string file) 
     { 
     SQLiteConnection m_dbConnection; 
     string test = "Data Source=" + file + ";Version=3;"; 
     m_dbConnection = new SQLiteConnection(test); 
     m_dbConnection.Open(); 
     SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); 
     SQLiteDataReader reader = command.ExecuteReader(); 
     if (check == "0") 
     { 
      while (reader.Read()) 
       comboBox1.Items.Add(reader["name"] + "." + reader["TLD"]); 
      comboBox1.SelectedIndex = 0; 
     } 
     else 
     { 
      proxy = reader["proxyip"].ToString(); 
      check = "0"; 
     } 
    } 

에러

파일 변수는 2 개 값 중 하나로 충전된다 "URI 포맷이 지원되지 않습니다"인 에러를 제공하는 기능이다.

string filelocal = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\unblocker\\sites.db"; 

또는

string remotefile = "http://127.0.0.1/test.db"; 

오류를 제공 한 원격 파일이다.

+0

어떤 오류가 발생합니까? 정확한 오류. – CloudyMarble

+0

매개 변수 파일의 정확한 값은 무엇입니까? – CloudyMarble

답변

0

연결 문자열은 로컬 파일 시스템에서 예상되는 db 파일을 데이터 소스로 사용합니다.이 파일은 example code입니다.

사용이 transorfm 수 있습니다

Uri uriFormatted = new Uri(file); 
uriFormatted.AbsolutePath; // Try to use this value instead to call your function 

편집

SQLite는 로컬 독립형 데이터베이스, 즉 독립형 소프트웨어를 사용

SQLitening 사용을 고려 :

SQLitening을 널리 사용되는 SQLite datab의 클라이언트/서버 구현입니다. ase.

+0

잘 로컬 파일에서 작동하도록 할 수 있지만 IP 또는 URL을 사용하여 파일을 액세스하면 더 이상 작동하지 않습니다. 127.0.0.1을 사용하는 이유는 그것을 테스트하기 위해 작은 서버를 실행 한 이후입니다. – Harry

+0

SQLite는 내장 데이터베이스이며 클라이언트 - 서버로 사용하기위한 것이 아닙니다. 왜 SQLititing을 사용하지 않습니까? – CloudyMarble

+0

솔직히 말해서 나는 그것을 결코 들어 보지 못했습니다. XD. – Harry

관련 문제