Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

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

$
0
0

I use helper code below to get the first ID from MyTable but an error. How should this code be made accessible?

public Task<MyTable> GetLastTableItem(int id)
{
    return _db.Table<MyTable>().Where(i => i.ID == id).FirstOrDefaultAsync();
}

Then I want to display it in label. How should this be made?

void GetLastItem(object sender, EventArgs e)
{
  Label label = new Label()
  label.Text = bla''bla''bla.GetLastTableItem();
}

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>