数据表列到数组 [英] Datatable column to array

查看:62
本文介绍了数据表列到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我已将字符串数组声明为此:

昏暗array()作为字符串

我的ID列具有数据表,我想将该列中的所有值转换/添加到数组.

我该怎么做?

Hello,

I have declared string array as this one:

dim array() as string

I have datatable with ID column and I want to convert / add all values from this column to array.

How can I do that?

推荐答案

检查

谢谢您的提问,

您可以尝试以下操作:

Thank you for your question,

You can try with this:

Dim dr As DataRow, dc As DataColumn

For Each dr In dt.Rows
 For Each dc in dt.Columns
  arr( )( dc.ColumnName() ) = dr( dc )
 Next
Next



谢谢,
马蒙



Thanks,
Mamun


这篇关于数据表列到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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