%@LANGUAGE="VBSCRIPT"%> <% Dim rsCategories Dim rsCategories_numRows Set rsCategories = Server.CreateObject("ADODB.Recordset") rsCategories.ActiveConnection = MM_sqlChoiceIT26oct04_STRING rsCategories.Source = "SELECT CategoryName, CategoryDescription FROM dbo.tCategories WHERE CountryID =1 AND CategoryDescription IS NOT NULL ORDER BY ParentCategoryID ASC" rsCategories.CursorType = 0 rsCategories.CursorLocation = 2 rsCategories.LockType = 1 rsCategories.Open() rsCategories_numRows = 0 %> <% ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables Dim rsCategories_total Dim rsCategories_first Dim rsCategories_last ' set the record count rsCategories_total = rsCategories.RecordCount ' set the number of rows displayed on this page If (rsCategories_numRows < 0) Then rsCategories_numRows = rsCategories_total Elseif (rsCategories_numRows = 0) Then rsCategories_numRows = 1 End If ' set the first and last displayed record rsCategories_first = 1 rsCategories_last = rsCategories_first + rsCategories_numRows - 1 ' if we have the correct record count, check the other stats If (rsCategories_total <> -1) Then If (rsCategories_first > rsCategories_total) Then rsCategories_first = rsCategories_total End If If (rsCategories_last > rsCategories_total) Then rsCategories_last = rsCategories_total End If If (rsCategories_numRows > rsCategories_total) Then rsCategories_numRows = rsCategories_total End If End If %> <% ' *** Recordset Stats: if we don't know the record count, manually count them If (rsCategories_total = -1) Then ' count the total records by iterating through the recordset rsCategories_total=0 While (Not rsCategories.EOF) rsCategories_total = rsCategories_total + 1 rsCategories.MoveNext Wend ' reset the cursor to the beginning If (rsCategories.CursorType > 0) Then rsCategories.MoveFirst Else rsCategories.Requery End If ' set the number of rows displayed on this page If (rsCategories_numRows < 0 Or rsCategories_numRows > rsCategories_total) Then rsCategories_numRows = rsCategories_total End If ' set the first and last displayed record rsCategories_first = 1 rsCategories_last = rsCategories_first + rsCategories_numRows - 1 If (rsCategories_first > rsCategories_total) Then rsCategories_first = rsCategories_total End If If (rsCategories_last > rsCategories_total) Then rsCategories_last = rsCategories_total End If End If %>
|
||||||||||||||||||||
copyright (c) 2005-06 ChoiceBiz Ltd. |