3
내가 오류 얻을
"데이터 소스는 비워 둘 수 없습니다" "데이터 소스가 비어있을 수 없습니다를 사용합니다. 메모리 : 메모리 데이터베이스를 엽니 다"SQLite는
// Get Current Users App Data
string documentsFolder = Environment.GetFolderPath
(Environment.SpecialFolder.ApplicationData);
string[] tempstr = documentsFolder.Split('\\');
string tempstr1 = "";
documentsFolder += "\\Google\\Chrome\\User Data\\Default\\History";
if (tempstr[tempstr.Length - 1] != "Local")
{
for (int i = 0; i < tempstr.Length - 1; i++)
{
tempstr1 += tempstr[i] + "\\";
}
documentsFolder = tempstr1 + "Local\\Google\\Chrome\\User Data\\Default\\History";
}
// Check if directory exists
if (Directory.Exists(documentsFolder))
{
// return ExtractUserHistory(documentsFolder);
}
string connectionString;
connectionString = string.Format(@"DataSource={0}", documentsFolder);
다음
내 연결 문자열입니다 어떤 도움
SQLiteConnection conn = new SQLiteConnection(connectionString);
conn.Open();
감사 :
그리고 여기 내 연결입니다.
http://stackoverflow.com/questions/4039720/c-sharp-sqlite-what-is-data-source-cannot-be-empty-use-memory-to-open-an – paragy
당신은 이것을 단순화 할 수 있습니다. 'Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData)'를 사용한다면, * ROAMING * 대신에 * LOCAL *이 항상 필요하다. 또한 [Path.Combine] (http://msdn.microsoft.com/en-us/library/dd781134) 또는 적어도 [StringBuilder.Append] (http://msdn.microsoft.com/en-us/) 사용을 고려하십시오. 라이브러리/ds86a594)를 사용하는 것이 좋습니다. – Filburt