How can i get acces to my fields after passing whole record as result of the function? I would like to do the same thing in TEST() function as in GetRecord function - the commented line
public void TEST()
{
var x = GetRecord(1,1);
Button.Text = ????
}
public async Task<Questions> GetRecord(int actualLevel, int actualLanguage)
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("QuestionDatabase.db");
Random rnd = new Random();
var query = await conn.Table<Questions>().Where(x => x.FK_ID_DifficultyLevel == actualLevel && x.FK_ID_Languages == actualLanguage).ToListAsync();
int r = rnd.Next(query.Count);
//Button.Text = query.ElementAt(r).Question; <- How to make the same thing in main after passing result?
return query.ElementAt(r);
}
The function above is connecting to the database and passing random record.(which foreign key for language and lvl = some int value). The record have fields like: - Question, answer
and i want paste the strings from this fields into button text field.
Aucun commentaire:
Enregistrer un commentaire