Frågan#1
Är det smart att lägga antalet poster i "tillståndsmultimängden" och kolla där innan man hämtar antalet ur databasen?
If ViewState("totalRecords") Is Nothing Then
totalRecords = GetmeDSCount()
Else
totalRecords = CType(ViewState("totalRecords"), Integer)
End If
' Return total records in database
Private Function GetmeDSCount() As Integer
Dim connection As SqlConnection = New _
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim command As SqlCommand = New SqlCommand("SELECT Count(*) FROM my_posts", connection)
connection.Open()
Dim count As Integer = CType(command.ExecuteScalar(), Integer)
connection.Close()
Return count
End Function
