Ornarirutty
New Member
Is it possible to get the count of rows from SqlDataReader, if not what is the best way to get it?<BR><BR>Thanks in advance,<BR><BR>Tommy McConnellHi Tommy Here's a simple solution for you<BR><BR>Dim i As Integer<BR><BR> Do While ds.Read<BR> i += 1<BR> Loop<BR><BR>Response.Write(i)Thanks for the help. I created a function to do the worka nd return an integer.<BR>'reader is a SqlDataReader object<BR>FUNCTION getRowCount(reader) AS Integer<BR> DIM i AS Integer<BR> i = 0<BR> DO WHILE reader.Read()<BR> i += 1<BR> LOOP<BR> RETURN i<BR>END FUNCTION<BR><BR>Only problem is resetting the SqlDataReader back to first record. As of now i just rerun the query.<BR><BR>Thanks again,<BR><BR>Tommy