how to get record count in oledbdatareader
hi guys,
i am using access as backend in my project. i'am able to retreive data from the database and assigning to textbox. but i wan't to know the no of records.
is there anything just like rs.recordcount in vb6.0
code:
Dim dread As OleDbDataReader = cmd.ExecuteReader()
While dread.Read
data1.Text = dread(1)
data2.Text = dread(2)
data3.Text = dread(3)
End While
Re: how to get record count in oledbdatareader
You can increment your counter in each iteration of the While dr.read loop, that'd give you the number of records.
Re: how to get record count in oledbdatareader
Quote:
Originally Posted by mendhak
You can increment your counter in each iteration of the While dr.read loop, that'd give you the number of records.
thanx, i'll try
Re: how to get record count in oledbdatareader
thanx mendak
but my problem is if dr is null i've to input the value otherwise it must take from dtabase. i wan't to check wether database is having any records or not. how to do it
Re: how to get record count in oledbdatareader
VB Code:
dim i as integer=0
While dread.Read
data1.Text = dread(1)
data2.Text = dread(2)
data3.Text = dread(3)
i+=1
End While
if i <= 0 then
'no records
end if
Re: how to get record count in oledbdatareader
Re: how to get record count in oledbdatareader
Re: how to get record count in oledbdatareader
Quote:
Originally Posted by kishorepv
Resolved
Edit the title and icon of your first post. That way it shows up on the thread listing for the forum section. :)