View Full Version : Missing Row in datareader
mrholt
08-14-2003, 08:03 PM
working on 1st asp.net project
I'm doing a datareader bind to a repeater but i'm missing one row? Any ideas?
Thanks
ScottInTexas
08-15-2003, 04:53 PM
Supply your code in question so we can see what might be wrong.
mrholt
08-15-2003, 05:01 PM
here is code
Private Sub btnDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDate.Click
Dim Query As String
Query = "SELECT SessionDate, SessionTime, SessionID, SessionTimeEnd, CourseID, LocationID FROM Sessions"
' Define the Connection
Dim strConnect As String
strConnect = SqlConnection1.ConnectionString
' Open the Connection
Dim ConCheckUser As New System.Data.SqlClient.SqlConnection(strConnect)
ConCheckUser.Open()
' Try to execute the SQL command using a READER
Dim CheckForUser As New System.Data.SqlClient.SqlCommand(Query, ConCheckUser)
Dim rdrCheckForUser As System.Data.SqlClient.SqlDataReader = CheckForUser.ExecuteReader()
' If .read is true then the row(s) were found
If (rdrCheckForUser.Read = True) Then
Repeater1.DataSource = rdrCheckForUser
Repeater1.DataBind()
rdrCheckForUser.Close()
End If
End Sub
allida77
08-15-2003, 05:06 PM
datreader is foward read only. I think what is happening you are checking to see if it "rdrCheckForUser.Read = True" moving it one row then databinding. Dont worry about checking for rows just bind it.
mrholt
08-15-2003, 05:25 PM
removed if statement works great
Thanks :thumbsup:
Matt
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.