I am using the below code to loop through all the records in a datareader and I am just wondering if someone has done the samething using dataset....I really appreciate if you show me how i can do this for dataset
drc2 = CSVItems.ExecuteReader()
'for field name
For i = 0 To drc2.FieldCount - 1
If i < (drc2.FieldCount - 1) Then
sb.Append(Chr(34) & drc2.GetName(i) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc2.GetName(i) & Chr(34) & vbCrLf)
End If
Next
'for field value
While drc2.Read()
For i = 0 To drc2.FieldCount - 1
If i < (drc2.FieldCount - 1) Then
sb.Append(Chr(34) & drc2.GetValue(i).ToString.Replace(Chr(34), Chr(34) & Chr(34)) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc2.GetValue(i).ToString & Chr(34) & vbCrLf)
End If
Next
End While
drc2 = CSVItems.ExecuteReader()
'for field name
For i = 0 To drc2.FieldCount - 1
If i < (drc2.FieldCount - 1) Then
sb.Append(Chr(34) & drc2.GetName(i) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc2.GetName(i) & Chr(34) & vbCrLf)
End If
Next
'for field value
While drc2.Read()
For i = 0 To drc2.FieldCount - 1
If i < (drc2.FieldCount - 1) Then
sb.Append(Chr(34) & drc2.GetValue(i).ToString.Replace(Chr(34), Chr(34) & Chr(34)) & Chr(34) & ",")
Else
sb.Append(Chr(34) & drc2.GetValue(i).ToString & Chr(34) & vbCrLf)
End If
Next
End While