大家好。从数据中选择代码后,我想在txthouse中显示Townhouse的值。谢谢。
DataTable dtRefItem = Common.Common.GetData("SELECT Townhouse FROM County where code= '"+txtbox.text"'"
一个DataTable
通常包含多个DataRow
秒。即使只选择一个,您也需要从DataTable.Rows
-property访问该行。
string townHouse = null;
if(dtRefItem.Rows.Count > 0)
{
townhouse = dtRefItem.Rows[0].Field<string>("Townhouse");
}
txthouse.Text = townHouse;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句