本文介绍了将数据从SQLite数据库绑定到条目Xamarin表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取SQLite数据库中 PresAddress列的数据.我想获取" PresAddress "列数据,并将该数据绑定到我的输入字段. PresAddress在tblContacts内部.我该怎么办?
I want to get the data of PresAddress column in SQLite Database. I want to get the "PresAddress" column data and bind that data to my entry field. PresAddress is inside tblContacts. How can I get that?
这是我的代码:
private void rcodePicker_SelectedIndexChanged(object sender, EventArgs e)
{
var pickedRetailerCode = rcodePicker.Items[rcodePicker.SelectedIndex];
var db = DependencyService.Get<ISQLiteDB>();
var conn = db.GetConnection();
var getUser = conn.QueryAsync<ContactsTable>("SELECT * FROM tblContacts WHERE ContactID=?", pickedRetailerCode);
var resultCount = getUser.Result.Count;
if (resultCount < 1)
{
//MessagingCenter.Send(this, "Http", Retailer);
}
else
{
var result = getUser.Result;
entStreet.Text = ;
}
}
推荐答案
使用此:
for (int i = 0; i < resultCount; i++)
{
var result = getUser.Result[i];
entStreet.Text = result.PresAddress;
entBarangay.Text = result.PresBarangay;
entCity.Text = result.PresTown;
entProvince.Text = result.PresProvince;
entDistributor.Text = result.PresDistrict;
}
这篇关于将数据从SQLite数据库绑定到条目Xamarin表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!