3
Answers

How load and view first item from xamarin sql database in C#

yan cus

yan cus

4y
503
1
I use helper code below to get the first ID from MyTable but an error. How should this code be made accessible?
  1. public Task<MyTable> GetLastTableItem(int id)  
  2. {  
  3.     return _db.Table<MyTable>().Where(i => i.ID == id).FirstOrDefaultAsync();  
  4. }  
Then I want to display it in label. How should this be made?
  1. void GetLastItem(object sender, EventArgs e)  
  2. {  
  3.     Label label = new Label();
  4.     label.Text = bla''bla''bla.GetLastTableItem();  
  5. }  
Answers (3)