I have this code in my WinRT app:
internal static List<PhotraxBaseData> GetPhotosets()
{
List<PhotraxBaseData> psets = new List<PhotraxBaseData>();
using (var db = new SQLite.SQLiteConnection(App.DBPath))
{
string sql = "SELECT DISTINCT photosetName FROM PhotraxBaseData ORDER BY
photosetName";
psets = db.Query<PhotraxBaseData>(sql);
}
return psets;
}
Which is called this way:
private void flyoutOpenPhotosets_Opened(object sender, object e)
{
lstbxPhotosets.ItemsSource = PhotraxSQLiteUtils.GetPhotosets();
}
What I end up with this is a listbox filed with items that say: "Photrax.Model.PhotraxBaseData"
All I want is just that one column (photosetName), but when I tried to return List<String> instead of List<PhotraxBaseData> like so:
internal static List<String> GetPhotosets()
{
List<String> psets = new List<String>();
using (var db = new SQLite.SQLiteConnection(App.DBPath))
{
string sql = "SELECT DISTINCT photosetName FROM PhotraxBaseData ORDER BY
photosetName";
psets = db.Query<String>(sql);
}
return psets;
}
...I get, on this line: "psets = db.Query<String>(sql);", the following compile-time err msg:
'string' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'SQLite.SQLiteConnection.Query<T>(string, params object[])'
So how can I accomplish this?