Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

missing the first record in the data grid 1

Status
Not open for further replies.

jmeckley

Programmer
Jul 15, 2002
5,269
US
I have a very strange situation with 3 datagrids on a web form. The grids drop the 1st record. If I have a query that pulls 4 records the grids display 3!

The Grids are populated by data readers. The data readers get the records through stored procedures. I tested the stored procs in Sql Server and they select the correct number of records. I also have this same information binded to a check box list on another page and that pulls up the correct number records also. I have Data Grids in other sections of my app and they display all the records correctly.

If there are no records in the data reader the the entire grid is hidden (header, footer, details). If 1 record is in the data reader then the header is displayed but the 1st record is not.

Any ideas why the 1st record will not display? Thanks for your insight.

Jason Meckley
Database Analyst
WITF
 
What code are you using to put the data in the grid?

It sounds like your using row count. if that is the case, then your probibly starting your count at 1 insted of 0. That would be my first guess anyway
 
Thanks for the insight, you were right. I may code looked like this:
[tt]
Cnn.Open()
rdrRecord = cmdRecord.ExecuteReader
While rdrRecord.Read
dgRecord.DataSource = rdrRecord
dgRecord.DataBind()
End While
Cnn.Close()
[/tt]
Once I removed the [tt]while rdrRecord.read[/tt] The results executed correctly.

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top