从datatable访问特定列值 [英] access particular column value from datatable

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

问题描述

如何在vb.net中访问数据表特定列的值?我想在循环中添加case

how to access value of particular column of datatable in vb.net ? I want to add case in loop

推荐答案

基本上它会是..

Basically it would be..
Dim o As Object = dataTable.Rows.Item(0).Item("ColumnNameOrIndex")



如需更多清关,请参阅..

如何从数据表中读取特定列的值。 [ ^ ]

http://p2p.wrox.com/pro-vb -6 / 12294-how-get-value-datatable-column.html [ ^ ]


'假设您有一个名为dt1的数据表,列名为Col1(字符串数据类型)和COL1。读取第0行的值Col1



'Assuming you have a datatable named dt1 with columns name Col1 (string datatype) and Col1. To read the value od Col1 at row 0

Dim myStr As String  = dt1.Rows(0)("Col1").ToString()


这篇关于从datatable访问特定列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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