Click to See Complete Forum and Search --> : How to count recordset in Asp.Net


akrashdi
04-22-2004, 03:50 PM
Hi,

Here are CLASSIC ASP examples, how can we do these things in Asp.Net

-----------------------------

MyRcordset.Count()


-----------------------------

While not MyRecordset.EOF

coding here

Recordset1.MoveNext()
wend



Regards
AKR

PeOfEo
04-22-2004, 06:51 PM
well I am going to have to say it would be pretty hard to count a recordset in asp.net considering that asp.net does not have a recordset object. It has been replaced with a dataset. Here is some sample usage and how to count

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
Dim DBConn as sqlConnection
Dim DBCommand As sqlDataAdapter
Dim DSPageData as New DataSet
DBConn = new SqlConnection("Server=***,****;User ID=*****;Password=*****;database=*****")
DBCommand = New sqlDataAdapter _
("Select * " _
& "From * where *=* order By * DESC", DBConn)
DBCommand.Fill(DSpagedata, _
"gridinfo")
yourdatagrid/repeater.DataSource = _
DSpagedata.Tables("gridinfo").DefaultView
yourdatagrid/repeater.DataBind()
lblmessage.text="There are currently " & dspagedata.tables("gridinfo").rows.count & " records in the data base"
End Sub
</Script>