Hi,


is there a method check the number of records in data reader?
like the count of rows. ?

Recommended Answers

All 2 Replies

hi sweetiepie, Ijust want to share something regarding the checking of rows returned from the database, I'm using datatable and sqldataadapter and i found out that it's much easier to use. Here's the code!

'sqlcon as sql connection
dt = New DataTable
        sda = New SqlDataAdapter("SELECT * FROM TABLENAME", sqlcon)
        sda.Fill(dt)
        If dt.Rows.Count = 0 Then
'write something
        Else
'write something
                    End If

Mark this thread as solved if this was helpful.

SELECT Count(*) from TableName
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.