我在这条以 SQLiteConnection 开头的行下面看到一个蓝色的波浪线,不知道我错过了什么。我正在使用 SQLiteAsyncConnection,因为我在某处读到它不支持像 InsertWithChildren 这样的方法,所以想到尝试 SQLiteConnection 类。
string dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
SQLiteConnection db = new SQLiteConnection(dbPath);
这些是我上面的 using 语句:
using SQLite.Net;
using SQLiteNetExtensions.Extensions;
这是我收到的错误消息
Error 2 'SQLite.Net.SQLiteConnection' does not contain a constructor that takes 1 arguments D:\OneDrive\Projects\SQLiteAsyncConnection Class\sqlite-net\MainPage.xaml.cs 28 31 sqlite-net
最佳答案
您正在使用另一个库的构造函数 - 基本的“sqlite-net”仅需要一个参数构造函数,但 SQLite.Net 也需要一个平台参数。 Here您可以找到文档和构造函数示例:
public class Database : SQLiteConnection
{
private const string DATABASE_NAME = "sqlite.db";
private static ISQLitePlatform platform = new SQLitePlatformWin32();
public Database()
: base(platform, DATABASE_NAME)
{
CreateTable<ClassExample>();
}
}
关于SQLiteConnection语句错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29860581/