You can do that automatically,
you always need to count records on the DataSet itself
---------------------------------------
Sub BindSQL()
Dim MyConnection As SqlConnection
Dim DS as DataSet
Dim MyCommand As SqlDataAdapter
Dim RcdCount As Integer
'Our SQL string
Dim sqlStr As String = "SELECT titles.title, authors.au_lnam e, " & _
"authors.au_fna me, titles.price " & _
"FROM authors INNER JOIN titleauthor ON " & _
"authors.au _id = titleauthor.au_ id " & _
"INNER JOIN titles ON " & _
"titleauthor.ti tle_id = titles.title_id "
'The connection to our database
Dim strConn As String = "server=(local) ;uid=sa;pwd=;" & _
"database=pubs; Trusted_Connect ion=yes;"
'Open up our connection with our connection object
MyConnection = New SQLConnection(s trConn)
'To execute our Sql Statement and provide our active connection
MyCommand = NewSqlDataAdapt er(sqlStr, MyConnection)
'Create instance of DataSet object and fill our predetermined
'datagrid with it and we name it
DS = new DataSet()
MyCommand.Fill( DS, "pubs")
RcdCount = DS.Tables("pubs ").Rows.Count.T oString()
RecordCount.Tex t = "<b><font color=red>" & RcdCount & "</fontrecords
found"
Pubs.DataSource = DS
Pubs.Databind()
lblPageCount.Te xt = "Page " & Pubs.CurrentPag eIndex + 1 & " of " &
Pubs.PageCount
End Sub
---------------------------------------
you can see this link to have a better idea
http://www.developerfusion.co.uk/show/4060/2/
--
Bruno Alexandre
"a Portuguese in København, Danmark"