What does "Data Source cannot be empty. Use :memory: to open an in-memory database" mean?

Verve Innovation picture Verve Innovation · Oct 28, 2010 · Viewed 17.7k times · Source

I recently converted my SQL Server database into SQLite DB. But when I try to open my SQLite using .Open() it throws me this error:

Data Source cannot be empty.  Use :memory: to open an in-memory database

Edit: added connection string:

ConnectionString = @"Data Source=D:\XXX.db;Version=3";
connection = new SQLiteConnection(connectionString);
connection.Open();

Why do I get this? I converted the same SQL Server database to SQL CE and mySQL and I didn't get these errors.

Answer

Ben Straub picture Ben Straub · Oct 10, 2011

There's a space after your data source: Data Source= D:\XXX.db. Also, in your copy/paste, there's no closing quote to the connection string. Here's a connection string that works for me for the testing tool:

@"Data Source=C:\Temp\Test.db3;Pooling=true;FailIfMissing=false;Version=3"