%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var rs_test = Server.CreateObject("ADODB.Recordset");
rs_test.ActiveConnection = MM_cn_forum_STRING;
rs_test.Source = "SELECT * FROM FORUM_CATEGORY";
rs_test.CursorType = 0;
rs_test.CursorLocation = 2;
rs_test.LockType = 1;
rs_test.Open();
var rs_test_numRows = 0;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var rs_test_total = rs_test.RecordCount;
// set the number of rows displayed on this page
if (rs_test_numRows < 0) { // if repeat region set to all records
rs_test_numRows = rs_test_total;
} else if (rs_test_numRows == 0) { // if no repeat regions
rs_test_numRows = 1;
}
// set the first and last displayed record
var rs_test_first = 1;
var rs_test_last = rs_test_first + rs_test_numRows - 1;
// if we have the correct record count, check the other stats
if (rs_test_total != -1) {
rs_test_numRows = Math.min(rs_test_numRows, rs_test_total);
rs_test_first = Math.min(rs_test_first, rs_test_total);
rs_test_last = Math.min(rs_test_last, rs_test_total);
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (rs_test_total == -1) {
// count the total records by iterating through the recordset
for (rs_test_total=0; !rs_test.EOF; rs_test.MoveNext()) {
rs_test_total++;
}
// reset the cursor to the beginning
if (rs_test.CursorType > 0) {
if (!rs_test.BOF) rs_test.MoveFirst();
} else {
rs_test.Requery();
}
// set the number of rows displayed on this page
if (rs_test_numRows < 0 || rs_test_numRows > rs_test_total) {
rs_test_numRows = rs_test_total;
}
// set the first and last displayed record
rs_test_last = Math.min(rs_test_first + rs_test_numRows - 1, rs_test_total);
rs_test_first = Math.min(rs_test_first, rs_test_total);
}
%>