如何从C#数据集(Dataadapter)获取字段值 [英] How Do I Get Field Value From C# Dataset(Dataadapter)

查看:253
本文介绍了如何从C#数据集(Dataadapter)获取字段值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



i填充我的数据集(DataAdapter方法),查询类似



select customerid,Customername ,来自客户的工作(来自microsoft sql server数据库的查询)



我如何直接从数据集获得字段值,如CurrentRow的客户名

使用DataRow类(Saytem.Data.DataRow)



谢谢

hello

i fill my dataset(DataAdapter method) with query like

select customerid,Customername,job from customers(query from microsoft sql server Database)

how do i get field value like Customername for CurrentRow
directly from dataset without using DataRow Class (Saytem.Data.DataRow)

Thanks

推荐答案

您可以直接索引到数据集的元素。数据集包含一个表,表包含行。



dataset.Tables.Item(0).Rows.Item(rowindex).Item(列名 )



使用DataRow使其更简单就是为什么不这样做。
You can index directly to the elements of the dataset. The dataset contains a table and the table contains rows.

dataset.Tables.Item(0).Rows.Item(rowindex).Item("name of column")

Using a DataRow makes it simpler is all so why not.


这篇关于如何从C#数据集(Dataadapter)获取字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆