i'm converting a classic asp website to .NET and could use some suggestions to this problem.
original code:
Dim oCountCMD
oCountCMD = Server.CreateObject("ADODB.Command")
With oCountCMD
.ActiveConnection = Application("ConnString")
.CommandText = "sp_GetSearchHistoryCount"
.CommandType = .CommandType.StoredProcedure
.oCountCMD(1) = strUser
.oCountCMD(2) = DateAdd("n", -1, Now())
.Execute()
If oCountCMD(0) > 60 Then
CheckSearchCounts = True
Else
CheckSearchCounts = False
End If
End With
oCountCMD = Nothing
my unfinished converted code:
Dim objConnection As New SqlConnection(Application("ConnString"))
Dim oCountCMD As New SqlCommand("sp_GetSearchHistoryCount", objConnection)
With oCountCMD
.CommandType = CommandType.StoredProcedure
.Parameters.Add(New SqlParameter("@UserName", SqlDbType.VarChar, 20))
.Parameters("@UserName").Value = strUser
.Parameters.Add(New SqlParameter("@SearchDt", SqlDbType.DateTime))
.Parameters("@SearchDt").Value = DateAdd("n", -1, Now())
// need to execute here, and find number of rows/records returned
End With
how can i capture the number of rows returned when i execute this stored procedure?