I am using VB.Net to query a SQL database and am placing the information retrieved in a datagrid. I need to know how to count the number of rows that meet the query criteria and placed in the datagrid itself for the user to see. I have posted the code for my query below, but am not sure what I should do to count the number of hits. Your help is greatly appreicated...thanks
If boolaction = False And boolcsrep = False Then
'enter sql date query
' dateactionrep = "Select * From ActionManagement where date between '" & begindate.ToShortDateString & " ' and '" & enddate.ToShortDateString & "'"
Dim dtdate1 As String
Dim dtdate2 As String
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
Dim rowcount As Integer
dtdate1 = dtpicker1.Value.ToShortDateString
dtdate2 = dtpicker2.Value.ToShortDateString
'create a sqlcommand to represent the query
cmd.CommandType = CommandType.Text
cmd.CommandText = "select * from ActionManagement where Date >= '" & dtdate1 & "' and Date <= '" & dtdate2 & "'"
'create a sqladapter to talk to the database
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd
'create a dataset to hold the data
Dim ds As DataSet = New DataSet
'fill dataset with results
'bind the it to data grid
dgResults.DataSource = ds
dgResults.DataMember = "Results"