I am just learning how to use stored procedures, and I am looking for some simple guidance...
I have a procedure stored in SQL Server called (usp_HitCount) as such:
SELECT page_name, hit_count FROM tbl_hit_count WHERE page_name= @PageName
On my ASP page I get the page name as such:
strPageName = Request.ServerVariables("SCRIPT_NAME")
When I was using an Access DB I would run the inline SQL as such:
strSQL = "SELECT page_name, hit_count FROM tbl_hit_count WHERE page_name='" & strPageName & "';"
so, my question is, how can I call my stored procedure, pass it strPageName as the @PageName variable, and then use the results as a normal recordset so I can increment my hit_count column as needed?
The point of all this is it is part of a function that I place on each page to increment the number of hits that page has received as such:
//PASS PAGE NAME AND GET RS HERE//
If rsCounter.EOF Then
iCount = 0
rsCounter.Fields("page_name").Value = strPageName
iCount = rsCounter.Fields("hit_count").Value
' Increment the count and update the DB
rsCounter.Fields("hit_count").Value = iCount + 1
' Close our connection
Set rsCounter = Nothing
' Return the count (pre-incrementation).
RetrieveAndIncrementCount = iCount