Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted

try this:-

VB
If dtset.Tables(0).Rows.count <> 0 then
   For i = 0 To dtset.Tables(0).Rows.Count - 1
    'Do Something (insert)
   Next
End If
 
Share this answer
 
Comments
Pro86 13-Aug-13 9:10am    
how i will get the column value every time
TrushnaK 13-Aug-13 9:36am    
Dim strData as String
If dtset.Tables(0).Rows.count <> 0 then
For i = 0 To dtset.Tables(0).Rows.Count - 1
strData = dsOrderBody.Tables(0).Rows(i)(8) -put your column index or column name
Next
End If
Do something like..
VB
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
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900