0

I'm writing an app and I'm trying to get data out of an existing database. I succeeded in importing the database and addressing it correctly using this tutorial. When I try to execute a query, my object are empty.

This is my code

public void TestDB() {
        using (var conn = new SQLite.SQLiteConnection(dbPath))
        {
            var cmd = new SQLite.SQLiteCommand (conn);
            cmd.CommandText = "select * from totem";
            var r = cmd.ExecuteQuery<Totem> ();

            tekst.Text = r[0].Title;
        }
    }
}

public class Totem
{
    [PrimaryKey, AutoIncrement]
    public string TotemId { get; set; }
    public string Title { get; set; }
    public string Body { get; set; }
    public string Synonyms { get; set; }
}

According to debug, r is a list and it contains 395 entries (the number of entries there are in Totem), but the Totem objects are empty as you can see:

debug

Does anyone know how to initialize them?

Thanks in advance.

Community
  • 1
  • 1
Frederick Eskens
  • 386
  • 3
  • 20

0 Answers0