|
-
Jun 30th, 2005, 03:45 AM
#1
Thread Starter
New Member
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
-
Jun 30th, 2005, 03:59 AM
#2
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.
-
Jun 30th, 2005, 06:08 AM
#3
Thread Starter
New Member
Re: how to get record count in oledbdatareader
 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
-
Jun 30th, 2005, 06:34 AM
#4
Thread Starter
New Member
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
-
Jun 30th, 2005, 08:47 PM
#5
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
-
Jun 30th, 2005, 11:31 PM
#6
Thread Starter
New Member
Re: how to get record count in oledbdatareader
-
Jun 30th, 2005, 11:34 PM
#7
Thread Starter
New Member
Re: how to get record count in oledbdatareader
-
Jun 30th, 2005, 11:50 PM
#8
Re: how to get record count in oledbdatareader
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|