J
Joe Delphi
Hi,
I am attempting to bind a dropdown list to a SQLDataReader My code
looks like this:
Dim DBComm As New SqlCommand
Dim DBReader As SqlDataReader
DBComm.Connection = DBConn
DBComm.CommandText = "SELECT TESTER FROM PERSONNEL ORDER BY TESTER"
DBReader = DBComm.ExecuteReader()
'Bind the drop down list to the DBReader'
If DBReader.HasRows() Then
ddlstSubBy.DataSource = DBReader
ddlstSubBy.DataTextField = "TESTER"
ddlstSubBy.DataValueField = "TESTER"
ddlstSubBy.DataBind()
End If
The PERSONNEL database table has a single field named TESTER.
When the program attempts to execute the .DataBind() statement, I get an
exception message that says:
"Index 0 is not non-negative and below total rows count."
What does this mean? I know that the query returned 6 rows so the problem
is not that the SQLDataReader is empty.
Any help appreciated.
JD
I am attempting to bind a dropdown list to a SQLDataReader My code
looks like this:
Dim DBComm As New SqlCommand
Dim DBReader As SqlDataReader
DBComm.Connection = DBConn
DBComm.CommandText = "SELECT TESTER FROM PERSONNEL ORDER BY TESTER"
DBReader = DBComm.ExecuteReader()
'Bind the drop down list to the DBReader'
If DBReader.HasRows() Then
ddlstSubBy.DataSource = DBReader
ddlstSubBy.DataTextField = "TESTER"
ddlstSubBy.DataValueField = "TESTER"
ddlstSubBy.DataBind()
End If
The PERSONNEL database table has a single field named TESTER.
When the program attempts to execute the .DataBind() statement, I get an
exception message that says:
"Index 0 is not non-negative and below total rows count."
What does this mean? I know that the query returned 6 rows so the problem
is not that the SQLDataReader is empty.
Any help appreciated.
JD