I have tried SQLiteConnection(":memory:")
and SQLiteConnection("sqlite::memory:")
but both of these fail with 'Invalid ConnectionString format'
3 Answers
try
var connection = new SQLiteConnection("Data Source=:memory:");
-
3This doesn't work for me. I get an exception 'The path is not of a legal form.'– SteztricCommented Jan 27, 2017 at 11:52
-
@Steztric try not putting a space between Data Source => new SqliteConnection("DataSource=:memory:")– AZ_Commented Feb 4, 2020 at 8:24
-
var connection = new SqliteConnection("Filename=:memory:");
Commented Nov 10, 2022 at 13:07
I'm using this:
var connectionStringBuilder = new SQLiteConnectionStringBuilder { DataSource = ":memory:" };
var connection = new SQLiteConnection(connectionStringBuilder.ToString());
Maybe it's too late, but FullUri=file::memory:?cache=shared;
is working.
-
2Any more info? I get
System.ArgumentException : Keyword not supported: 'fulluri'.
usingvar connection = new SqliteConnection("FullUri=file::memory:?cache=shared;");
– AndezCommented Sep 23, 2018 at 21:37 -
@Andrez Lowercase
SqliteConneciton
you are using is from different packageMicrosoft.Data.Sqlite
which doesn't work with FullUri parameter.– ghordCommented Nov 11, 2022 at 13:36