- Joined
- Feb 25, 2008
- Messages
- 5
- Reaction score
- 0
Hi
I am trying to convert the datreader into ArrayList. The ArrayList consist of four columns But what i am all getting is All the data in one column with multiple rows. What i actually what is to store all the data in ArrayList with the same format as it appeared in datareader so that i can bound it with GridView.
My current code is given bellow:
Dim dr As SqlDataReader = cmd.ExecuteReader()
Dim al As New ArrayList
If (dr.HasRows) Then
While (dr.Read())
Dim fields As Integer = dr.FieldCount()
' Dim a As Integer
For fields = 0 To dr.FieldCount - 1
al.Add(dr.Item(fields))
Next
End While
End If
I am trying to convert the datreader into ArrayList. The ArrayList consist of four columns But what i am all getting is All the data in one column with multiple rows. What i actually what is to store all the data in ArrayList with the same format as it appeared in datareader so that i can bound it with GridView.
My current code is given bellow:
Dim dr As SqlDataReader = cmd.ExecuteReader()
Dim al As New ArrayList
If (dr.HasRows) Then
While (dr.Read())
Dim fields As Integer = dr.FieldCount()
' Dim a As Integer
For fields = 0 To dr.FieldCount - 1
al.Add(dr.Item(fields))
Next
End While
End If