SQLDataReader.GetValue Methods

If I have a query that returns 5 columns from the database
Select col1, col2, col3 from table
1) What method would I use from the SQLDataReader class.
This is the code snippet
 Dim sql_reader As SqlClient.SqlDataReader

 While (sql_reader.Read())
                        ' Return String Data
                  ---->      strBuilder = sql_reader.GetValue()
                             End While

I do not want to use  sql_reader.getInt32()..
I want to make it generic
Thanks
eeiqAsked:
Who is Participating?
 
moe2sanConnect With a Mentor Commented:
suppose sdr is SQLDataReader.
you can use sdr.Item(0) to get the first column, sdr.Item(1) to get the second column, etc.
or sdr.Item("col1") where you can give the column name you want to read
0
All Courses

From novice to tech pro — start learning today.