[英]access sqlite from .net standard 2.0
I need to use .net standard 2.0 for my database component. 我需要对数据库组件使用.net标准2.0。 This component uses the Microsoft package Microsoft.Data.Sqlite for access.
该组件使用Microsoft程序包Microsoft.Data.Sqlite进行访问。 That seems to work but how can I create a database file?
这似乎可行,但是如何创建数据库文件? Are there any other packages I may use for accessing Sqlite under a .net standard 2.0 component?
我可以在.net标准2.0组件下使用其他任何软件包来访问Sqlite吗?
Best regards, Torsten 最好的问候,Torsten
Following works: 以下作品:
using (var connection = new SqliteConnection("" + new SqliteConnectionStringBuilder
{
DataSource = "C:\\temp\\test.db"
}))
{
connection.Open();
using (var command = connection.CreateCommand())
{
command.CommandText = "create table test(field1 varchar(20))";
command.ExecuteNonQuery();
}
}
It is created by default, there is no explicit create file or anything like this. 它是默认创建的,没有显式的创建文件或类似的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.