How to query at low level using SQLite.Net-PCL?
Asked Answered
E

0

6

I am using SQLite.Net-PCL in a UWP project. Now, I need to read one row of a table. I could use something like:

var row = await _conn.QueryAsync<MyType>("SELECT * FROM MyTable WHERE ID=100");

The problem is that the table has 150 columns and I do not want to write a class (MyType) just for this query. I would like to load all columns in a Dictionary<string, string> or similar, so I could get the values I need.

How can I do it using the SQLite.Net-PCL wrapper?

UPDATE:

The column names that I need to retrieve are only known in runtime, so I cannot create a class. The final purpose is to show a dashboard. The user can select 6 columns from a list of 150. Then, I want to show only these 6 columns in the view.

Emlin answered 27/7, 2016 at 15:32 Comment(3)
if the field names are defined by user in runtime, you need to save those field names in a separate table and then build your select statement around it. When Column Names are integral part of the program, you need to make sure they are also saved/retrieved. When the user picks from a list which columns he/she wants to see in the view. save their preferences and you should be good.Melissiamelita
Downvote? Really? Can the Person who downvoted my comment explain why?Melissiamelita
Did you find a solution? If yes, may you explain here? Thanks.Triage

© 2022 - 2024 — McMap. All rights reserved.