55

I have tried SQLiteConnection(":memory:") and SQLiteConnection("sqlite::memory:") but both of these fail with 'Invalid ConnectionString format'

3 Answers 3

95

try

var connection = new SQLiteConnection("Data Source=:memory:");
Sign up to request clarification or add additional context in comments.

3 Comments

This doesn't work for me. I get an exception 'The path is not of a legal form.'
@Steztric try not putting a space between Data Source => new SqliteConnection("DataSource=:memory:")
var connection = new SqliteConnection("Filename=:memory:");
7

I'm using this:

var connectionStringBuilder = new SQLiteConnectionStringBuilder { DataSource = ":memory:" };
var connection = new SQLiteConnection(connectionStringBuilder.ToString());

Comments

4

Maybe it's too late, but FullUri=file::memory:?cache=shared; is working.

It's knowledge from forum question

2 Comments

Any more info? I get System.ArgumentException : Keyword not supported: 'fulluri'. using var connection = new SqliteConnection("FullUri=file::memory:?cache=shared;");
@Andrez Lowercase SqliteConneciton you are using is from different package Microsoft.Data.Sqlite which doesn't work with FullUri parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.