从数据集中检索值 [英] Retreiving value from a datatset
本文介绍了从数据集中检索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!!!!
我有一个文本框命名为txtName.
我也有一个数据集,其中我从数据库中检索了ID,Name,Salary.如何将文本框的值设置为通过数据集从数据库检索的值.
如果是数据读取器,我将如何处理数据集????
Hi all!!!
i have a textbox naming txtName.
Also i have a dataset in which i have retreived ID, Name , Salary from the database. how can i set the value of the textbox to the value retreived from the databse through dataset.
Have it been data reader i would have done it how how to do it with dataset ???
推荐答案
数据集默认情况下包含数据表,因此至少会有1个数据表您应该通过
获得价值
txtName.text =数据集.Tables[0] .Rows [0] ["Name"].ToString();
datasets contains datatables by default there will be at least 1 datatable so you should get the value by
txtName.text = dataset.Tables[0].Rows[0]["Name"].ToString();
这篇关于从数据集中检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文