gpt4 book ai didi

SQLiteConnection语句错误

转载 作者:行者123 更新时间:2023-12-02 01:34:11 26 4
gpt4 key购买 nike

我在这条以 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com