|
-
Oct 7th, 2002, 08:04 AM
#1
Thread Starter
Hyperactive Member
Equivalent of Rs.Recordcount and RS.EOF
Hi there!
What is the equivalent of Recordset.Recordcount and Recordset.EOF in ASP.net?
For ex. how do I know, whether a DataReader has record(s) or not?
-
Oct 7th, 2002, 08:14 AM
#2
The .EOF property was replaced by a function call: DataSet.Read(), so:
VB Code:
Do While DataSet.Read()
'Your code here
Loop
RecordCount:
VB Code:
MsgBox("Record Count = " & DataSet.Tables("TableName").Count
-
Oct 7th, 2002, 08:23 AM
#3
Thread Starter
Hyperactive Member
Hi axion_sa ,
Thanks for the quick reply. but is there anyway can I avoid the while loop to know?
-
Oct 7th, 2002, 08:42 AM
#4
This should help a little:
VB Code:
Dim dt As DataTable
Dim dr As DataRow
Dim dc As DataColumn
For Each dt In ds.Tables 'Where ds is a DataSet
For Each dr In dt.Rows
For Each dc In dr.Columns
Console.WriteLines(dr(dc))
Next dc
Next dr
Next dt
-
Oct 11th, 2002, 01:52 PM
#5
Hyperactive Member
Seems to be some confusion about what is being talked about here. I pretty sure the question was about datareader and not datasets.
If Datareader.Read then
'the datareader contains a resultset.
-
Oct 11th, 2002, 11:26 PM
#6
Thread Starter
Hyperactive Member
Hi Musician!
Thanks for the reply. I still have one doubt.
Assuming my recordset has fetched just one record, and if I use the following code,
--------------
If Datareader.Read then
--------------
The resulset now would have come to the EOF no?[Since Datareader.Read is identical to RS.MoveNext]
-
Oct 12th, 2002, 08:58 AM
#7
Hyperactive Member
It is similar to MoveNext except for the fact that it is not on the first record until the first call to the read method.
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
|