Reputation: 5918
I get the error "Data Source cannot be empty. Use :memory: to open an in-memory database"
Here is my connection string:
// 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);
And here is my connection:
SQLiteConnection conn = new SQLiteConnection(connectionString);
conn.Open();
Thanks for any help.
Upvotes: 3
Views: 5672
Reputation: 1627
That error is given when the connection string is wrong.
In your @"Data Source={0}"
you must put Data Source instead of DataSource
Hope it helps.
Upvotes: 6