以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  为什么写在一句GetValues不能返回正确数值  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=143362)

--  作者:iceblock
--  发布时间:2019/11/22 8:22:00
--  为什么写在一句GetValues不能返回正确数值
Dim arr As String  \'\'直接一句码,返回 " System.String[] "
\'Dim lst As List(of String)
\'Dim arr2 As String \'分两句
Dim cmd As new SQLCommand
cmd.CommandText="sel ect ID from {表A}"
Dim dt As DataTable = cmd.ExecuteReader()
\'lst = dt.GetValues("ID")
arr = String.Join(",", dt.GetValues("ID").ToArray())
\'arr2 = String.Join(",", lst.ToArray())
Output.Show(arr)
\'Output.Show(arr2)

以上代码无法返回值。要写两句,请教为什么会这样?GetValues返回的是字符集合?   附"表A"如下
ID    DID   名称
1 11
1 12
2 21
2 22
2 23
3 31
3 32
3 33
3 34
3 35

--  作者:狐狸爸爸
--  发布时间:2019/11/22 9:39:00
--  
就分开两句写,为什么只有微软知道