I am developing a Windows 10 UWP app with a SQLite database. I need to retrieve data from multiple tables. I already have the following code to get data from a single table, but a custom object with the exact same amount and names of the columns of the table in question is needed.
public ObservableCollection<Employee> GetEmployees()
{
using (var dbConn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), App.DB_PATH))
{
List<Employee> myCollection = dbConn.Table<Employee>().ToList<Employee>();
ObservableCollection<Employee> EmployeesList = new ObservableCollection<Employee>(myCollection);
return EmployeesList;
}
}
I also know that it is possible to query a table using the following code, but still only from a single table.
public ObservableCollection<Question> GetQuestionsForAssessment(int assessment_id)
{
using (var dbConn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), App.DB_PATH))
{
List<Question> myCollection = dbConn.Query<Question>("select * from Question where AssessmentId = ?", assessment_id);
ObservableCollection<Question> QuestionsList = new ObservableCollection<Question>(myCollection);
return QuestionsList;
}
}
So does anybody know how I can query from multiple tables? Thanks