datareader -how can I know "no of records" return ?

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I can't find any property about the "no of records" of datareader .
I don't want to loop the datareader and use counter to count it.
Any suggestion?
Thanks
 
Hi Agnes,

You can try this,
\\\\
Dim cmd As SqlCommand
Dim sqlstring As String = "select count(*) from tbl"
cmd = New SqlCommand(sqlstring, conn)
cmd.Connection.Open()
Dim count As Integer = CInt(cmd.ExecuteScalar())
conn.Close()
////
I hope this helps a little bit?

Cor
 
Back
Top