Checking for empty data Reader

bristonar

New Member
OK, here is what I am trying to do. I want to bind a datareader to a Repeater control. If the datareader is empty I want to display a message that there are no records. I have it working for the most part but when I check to see if there are any records, it seems to advance one record. What is the best way to check for an empty data reader? Here is the code I have for the check and the binding:<BR><BR>if (myDataReader.Read()) then<BR>&nbsp;&nbsp;recentRP.Datasource = myDataReader<BR>&nbsp;&nbsp;recentRP.DataBind()<BR>else<BR>&nbsp;&nbsp;recentRPLabel.Text = "No records Found"<BR>end if<BR><BR>Can anyone help me? The binding and the code works fine except for that whole "increment one record' thing. <BR><BR>Thanks!<BR>Eugene<BR>
 
Back
Top