%@ Language="VBScript"%> <% ' Declare variables Dim iPageSize 'How big our pages are Dim strPageCount 'The number of pages we get back Dim strRecordCount 'The number of records returned Dim strPageCurrent 'The page we want to show Dim strSql 'SQL select to limit fields Dim conn 'The connection object Dim rs 'The recordset object Dim x 'Standard looping var Dim strSqlWhere Dim strSqlGroupBy Dim strSqlOrderBy Dim strSearchCriteria Dim strSearchSort Dim strSearch_authorize Dim strSearch_property Dim srtErrMsg Dim ConnString Dim strBackURL Dim strForwardURL Dim strFirstURL Dim strLastURL Dim strNumPages Dim strOrderBy_authorize Dim strOrderBy_property Dim ID ID = CStr(Request("ID")) ' using a DSN-less connection. ConnString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("data\gsi.mdb") 'set page size iPageSize = 75 If Request("page") = "" Then strPageCurrent = 1 Else strPageCurrent = CInt(Request("page")) End If ' default sql statements strSql = "SELECT time_stamp, file_url, authorize, subdate, property, management, propaddress, city, state, zip, phone, fax, website, guestrooms, auditmanager, title, email, quest01, quest02, quest03, quest04, quest05a, quest05b, quest05c, quest05d, quest05e, quest05f, quest06, quest07a, quest07b, quest08a, quest08b, quest09a, quest09b, quest10a, quest10b, quest10c, quest11a, quest11b, quest11c, quest12, quest13, quest14, quest15, quest16, quest17, quest18, quest19a, quest19b, quest19c, quest19d, quest20a, quest20b, quest20c, quest21, quest22, quest23, quest24, quest25, additionalinfo, disclaimer, pointtotal, modgrandtotal, percentagescore " strSql = strsql & "FROM survey" strSqlWhere = " WHERE ID =" & ID ' strSqlGroupBy = " GROUP BY time_stamp, file_url, authorize, subdate, property, management, propaddress, city, state, zip, phone, fax, website, guestrooms, auditmanager, title, email, quest01, quest02, quest03, quest04, quest05a, quest05b, quest05c, quest05d, quest05e, quest05f, quest06, quest07a, quest07b, quest08a, quest08b, quest09a, quest09b, quest10a, quest10b, quest10c, quest11a, quest11b, quest11c, quest12, quest13, quest14, quest15, quest16, quest17, quest18, quest19a, quest19b, quest19c, quest19d, quest20a, quest20b, quest20c, quest21, quest22, quest23, quest24, quest25, additionalinfo, disclaimer, pointtotal, modgrandtotal, percentagescore " strSqlOrderBy = "" ' default back and forward URLs strBackURL = "index.asp?page=" & strPageCurrent - 1 strForwardURL = "index.asp?page=" & strPageCurrent + 1 strSearch_authorize = CStr(Request("authorize")) strSearch_property = CStr(Request("property")) strSearchSort = CStr(Request("sortby")) strSearchStartPage = "index.asp" If len (strSearchSort) > 0 Then strSqlOrderBy = " Order by " & strSearchSort End If If strSearchSort = "authorize asc" Then strOrderBy_authorize = "index.asp?sortby=authorize desc" Else strOrderBy_authorize = "index.asp?sortby=authorize asc" End If If strSearchSort = "property asc" Then strOrderBy_property = "index.asp?sortby=property desc" Else strOrderBy_property = "index.asp?sortby=property asc" End If strBackURL = strBackURL & "&sortby=" & strSearchSort & "&authorize" & strSearch_authorize & "&property" & strSearch_property strForwardURL = strForwardURL & "&sortby=" & strSearchSort & "&authorize" & strSearch_authorize & "&property" & strSearch_property strOrderBy_authorize = strOrderBy_authorize& "&authorize" & strSearch_authorize & "&property" & strSearch_property strOrderBy_property = strOrderBy_property& "&authorize" & strSearch_authorize & "&property" & strSearch_property 'Open the connection string Set conn = Server.CreateObject("ADODB.Connection") conn.Open ConnString set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn ' set where and order by clauses if necessary strSql = strSql & strSqlWhere & strSqlGroupBy If len(strSqlOrderBy) > 0 Then strSql = strSql & strSqlOrderBy End If 'Response.Write ("
" & strSql & "") With cmd .CommandType = adCmdText .CommandText = strSQL End With Set rs = Server.CreateObject("ADODB.Recordset") ' Set cursor location and pagesize rs.CursorLocation = adUseClient rs.PageSize = iPageSize ' Open Recordset object and rs.Open cmd 'Disconnect from database cmd.ActiveConnection = nothing Set conn = Nothing If (rs.eof and rs.bof) Then 'No Data rs.Close Set rs = Nothing %>
<% Response.Flush Response.End End If ' Get the count of the pages using the given page size strPageCount = rs.PageCount strRecordCount = rs.RecordCount strCurrentPageMinRecord = strPageCurrent * iPageSize - (iPageSize -1) strCurrentPageMaxRecord = strPageCurrent * iPageSize If strRecordCount < strCurrentPageMaxRecord Then strCurrentPageMaxRecord = strRecordCount strFirstURL = "index.asp?page=1" strLastURL = "index.asp?page=" & strPageCount ' If the request page falls outside the range, ' give them the closest match (1 or max) If 1 > strPageCurrent Then strPageCurrent = 1 If strPageCurrent > strPageCount Then strPageCurrent = strPageCount ' Move to the selected page rs.AbsolutePage = strPageCurrent ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''' Error on line above with empty recordset ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' %>
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||