vb.net 如何从给定数据集中的数据集中获取第一个值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17804970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to take first value from dataset from given dataset
提问by C Sharper
I am using VB.NET
我正在使用 VB.NET
I have following code:
我有以下代码:
ds = gc.GetDataToListBinder("select distinct(tabname) tabname from Parameteronline where isactive='Y'")
ds is dataset containing only one column and 5 rows.
ds 是仅包含一列和 5 行的数据集。
I just wanted to take first value from this dataset.
我只是想从这个数据集中获取第一个值。
I tried:
我试过:
dds.Tables(0).Rows(0).Cells(0).toString()but this is not giving me value.
dds.Tables(0).Rows(0).Cells(0).toString()但这并没有给我带来价值。
I use to take value from dataset in C#.
我过去常常从 C# 中的数据集中获取值。
How should i take it from vb.net
我应该如何从 vb.net 获取它
回答by Zaki
Try below, but make sure your datatable has values:
试试下面,但要确保你的数据表有值:
dds.Tables(0).Rows(0)(0)
回答by Sriram Sakthivel
Try this
尝试这个
ds.Tables(0).Rows(0).ItemArray(0)

