如何在内存中创建sqlite数据库?

时间:2012-02-07 09:03:59

标签: c# sqlite

我已尝试SQLiteConnection(":memory:")SQLiteConnection("sqlite::memory:"),但这两项都失败了'无效的ConnectionString格式'

3 个答案:

答案 0 :(得分:77)

var connection = new SQLiteConnection("Data Source=:memory:");

答案 1 :(得分:4)

我正在使用它:

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

答案 2 :(得分:2)

也许为时已晚,但FullUri=file::memory:?cache=shared;正在发挥作用。

It's knowledge from forum question