I already know how you count the views for certain records in ASP. The SQL Statement should be something like:
'Update the Views
SQL= "UPDATE Spastore SET Views = Views + 1 " & _
"WHERE SpaStoreID = '" & strChosenStoreID & "'"
However, I am not sure how to do this in ASP.Net. I am trying to figure out where I should put this under my code for the DataList. Or should I create a separate sub procedure? Does anyone know the best way for me to accomplish this?
Here's some of my code:
'---------------------------------------------
' name: BindDataList()
'---------------------------------------------
Sub BindDataList()
Dim strConnect As String
Dim objConnect As New System.Data.SqlClient.SQLConnection(ConnectionString())
Dim objCommand As New System.Data.SqlClient.SQLCommand
Dim strSQL as String
Dim SQL as String
Dim dtaSpaStore As New System.Data.SqlClient.SQLDataAdapter()
Dim dtsSpaStore As New DataSet()
Dim strChosenStoreID
objConnect.Open()
'Get incoming querystring values
strChosenStoreID = request.params("ID")
'Start SQL statement
strSQL = "Select * From SpaStore, City, State, Area"
strSQL = strSQL & " where SpaStore.City = City.City"
strSQL = strSQL & " and SpaStore.State = City.State"
strSQL = strSQL & " and SpaStore.State = State.State"
strSQL = strSQL & " and SpaStore.AreaID = Area.AreaID"
strSQL = strSQL & " and SpaStoreID = '" & strChosenStoreID & "'"
strSQL = strSQL & " and Approve=1"