Forum Xamarin Cross Platform with Xamarin

Is it possible to return the value from SQLite database into the Entry (When the program starts)?

My database:

public class Kalorie
    {
        [PrimaryKey, AutoIncrement]
        public int Ilosc { get; set; }
        public DateTime Czas { get; set; }
        public int Teraz { get; set; }
    }

I wanted to return value from "Teraz" to Entry.

public Task<List<Kalorie>> GetTeraz()
{
    return _database.QueryAsync<Kalorie>($"SELECT Teraz FROM Kalorie;");
}
protected override async void OnAppearing()
        {
            base.OnAppearing();

            listView.ItemsSource = await App.Database.GetPeopleAsync();
            Entry2.Text = await App.Database.GetTeraz();       
        }

The assumption of the application is that the user enters the value "Entry1". This value is saved in the database in the "Teraz" field, and then when the user opens the application again, this value is loaded into "Entry2".

Best Answer

Answers

Sign In or Register to comment.