|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Okay, this is an ongoing problem that's driving me nuts. I must be missing something obvious???
Code:
'VB.NET
Dim objReader As SqlDataReader
objReader = objCmd.ExecuteReader()
If objReader.Read() Then
lblNoData.Text = "No data!"
Else
myDataList.DataSource = objReader
myDataList.DataBind()
End If
Okay checking for data with the "IF" statement uses up the first row of my data. What's a better way of doing this? |
|
#2
|
||||
|
||||
|
Maybe your could read the data into a variable then test the condition of the variable instead of the actual .Read()
|
|
#3
|
|||
|
|||
|
clone the data reader maybe and use one for read and one for data bind ...?
__________________
Regards, James Yang .NET Developer / Network Engineer MCSE, MCDBA, MCSA, CCNA http://www.yellowpin.com/ http://www.opentechsupport.com/ |
|
#4
|
|||
|
|||
|
Thanks guys for your responses!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > .Net SQLDataReader Skips the First Row... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|