Reputation: 11
When querying a database in SQLite.NET (UWP), I get the correct number of results, but every result is empty.
For example a query of
var products = db.Query<Product>("SELECT * FROM product WHERE
product_code LIKE ?", "'%" + code + "%'");
Will return a List of 121 products as I expect, but each individual product has null
/default
values.
Running the same code in Xamarin/SQLite.NET on Android, I get populated results as I would expect.
I'm not sure what might cause this. My packages are up to date and the fact it has the correct number of results but not any data suggests it's partially working. However, it seems it's failing to bind the data to the fields in the Product class, and I'm not sure how I can dig into that to correct it.
Upvotes: 0
Views: 236
Reputation: 11
This was down to casing in field names - I was struggling to find it because the UI in the UWP project isn't updating when I change the binding context (So even when I did changes that had it working it didn't look like it was).
I've avoided using any upper case characters in all field names in the project and column titles in the DB and that part of things is working now.
Upvotes: 1