小编Jet*_*ack的帖子

SQL逻辑错误或缺少数据库没有这样的表

我试图从Condition本地sqlite数据库中的表中读取所有数据.但是我收到此错误:

SQL逻辑错误或缺少数据库没有这样的表

数据库与调用它的文件位于同一目录中.

这是我的代码:

SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=myDatabase.sqlite;Version=3;");
m_dbConnection.Open();

try
{
    string sql = "select * from Condition";
    SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);

    SQLiteDataReader reader = command.ExecuteReader();

    while (reader.Read())
        Console.WriteLine("Name: " + reader["name"] + "\tScore: " + reader["id"]);

    Console.ReadLine();
    return null;
}
catch (Exception exc)
{
    return null;
}
finally
{
    m_dbConnection.Close();
}
Run Code Online (Sandbox Code Playgroud)

c# sqlite

9
推荐指数
2
解决办法
3万
查看次数

使用NSPredicate和ID数组过滤数组

我正在尝试使用过滤字典对象数组NSPredicate。我有一个Id数组,我想对此数组进行过滤,但是我不确定如何执行此操作。这是我最接近工作版本的版本。但是NSPredicate,当它作为NSString指南时,它以为Self.id是一个数字

NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"SELF.id CONTAINS %@", UserIds];
Run Code Online (Sandbox Code Playgroud)

但是,此错误与以下内容有关:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't look for value ((
"36eaec5a-00e7-4b10-b78e-46f7396a911b",
"26fc5ea2-a14b-4535-94e9-6fb3d113838c",
"0758a7d0-0470-4ff6-a96a-a685526bccbb",
"10dae681-a444-469c-840d-0f16a7fb0871",
"0280234c-36ae-4d5f-994f-d6ed9eff6b62",
"89F1D9D4-09E2-41D3-A961-88C49313CFB4"
)) in string (1f485409-9fca-4f2e-8ed2-f54914e6702a); value is not a string '
Run Code Online (Sandbox Code Playgroud)

您可以提供的任何帮助都会很棒。

arrays objective-c nspredicate

1
推荐指数
1
解决办法
763
查看次数

标签 统计

arrays ×1

c# ×1

nspredicate ×1

objective-c ×1

sqlite ×1