如何遍历数据集中的记录 [英] How to loop through records in a dataset
本文介绍了如何遍历数据集中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有数据集,里面有一些数据。
i想循环这个数据集所以我将在数据库中逐个插入值
谢谢
hello,
I have dataset which have some data in it.
i want to loop this dataset so i will insert one by one value in database
thanks
推荐答案
试试这个: -
try this:-
If dtset.Tables(0).Rows.count <> 0 then
For i = 0 To dtset.Tables(0).Rows.Count - 1
'Do Something (insert)
Next
End If
做类似的事情。
Do something like..
For Each Row As DataRow In dataset.Tables(0).Rows
For Each Coll As DataColumn In dataset.Tables(0).Columns
Dim s As String = Row(Coll.ColumnName).ToString() //insert it
Next
Next
这篇关于如何遍历数据集中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文