<%@ Language="VBScript"%> <% ' I'm using a DSN-less connection. 'ConnString = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=sa;PWD=;DATABASE=pubs" 'Conexao base de dados ConnString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("dados/pontoqual.mdb") ' Declare variables Dim iPageSize 'How big our pages are Dim strPageCount 'The number of pages we get back 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 If request("d1") <> "" Then Session("d1") = 10 'Get parameters from the dropdown box on the previous page. ' You could easily just use the default of 10 iPageSize = Session("d1") If Request("page") = "" Then strPageCurrent = 1 Else strPageCurrent = CInt(Request("page")) End If 'Open the connection string Set conn = Server.CreateObject("ADODB.Connection") conn.Open connstring set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn 'set sql statement to a local variable strSql = "SELECT * FROM noticias ORDER BY datahora DESC" 'adCmdUnspecified -1 Does not specify the command type argument. 'adCmdText 1 Evaluates CommandText as a textual definition of a command or stored procedure call. 'adCmdTable 2 Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query. 'adCmdStoredProc 4 Evaluates CommandText as a stored procedure name. 'adCmdUnknown 8 Default. Indicates that the type of command in the CommandText property is not known. 'adCmdFile 256 Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only. 'adCmdTableDirect 512 Evaluates CommandText as a table name whose columns are all returned. Used with Recordset.Open or Requery only. To use the Seek method, the Recordset must be opened with adCmdTableDirect. 'This value cannot be combined with the ExecuteOptionEnum value adAsyncExecute. With cmd .CommandType = adCmdText .CommandText = strSQL End With Set rs = Server.CreateObject("ADODB.Recordset") ' Set cursor location and pagesize rs.CursorLocation = adUseClient ' nºde registos por pagina rs.PageSize = 5 ' Open Recordset object and rs.Open cmd 'Disconnect from database cmd.ActiveConnection = nothing ' Get the count of the pages using the given page size strPageCount = rs.PageCount ' 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 flag=false if not rs.eof then flag=true rs.AbsolutePage = strPageCurrent end if ' Start output with a page x of n line 'Response.Write "Page " 'Response.Write strPageCurrent 'Response.Write " of " 'Response.Write strPageCount 'Response.Write "

" & vbCrLf %> pontoqual - consultores da qualidade, lda.


<% ' Continue with a title row in our table 'Response.Write "" & vbCrLf ' Show field names 'Response.Write vbTab & "" & vbCrLf 'For x = 1 To rs.Fields.Count ' Response.Write vbTab & vbTab & "" & vbCrLf 'Next ' Response.Write vbTab & "" & vbCrLf 'função para mudar de linha Function FormatStr(String) on Error resume next String = Replace(String, CHR(13), "") String = Replace(String, CHR(10) & CHR(10), "

") String = Replace(String, CHR(10), "
") FormatStr = String End Function ' Loop through our records if x<>0 then x=0 else x=request.querystring("xx") end if y=0 Do While rs.AbsolutePage = strPageCurrent And Not rs.EOF x=x+1 y=y+1 Response.Write vbTab & "

" ' Response.Write rs.Fields(x - 1).Name ' Response.Write "
" Response.Write vbTab & "" & vbCrLf Response.Write vbTab & vbTab & "" response.Write "" Response.Write vbTab & vbTab & "" Response.Write vbTab & vbTab & "" Response.Write vbTab & vbTab & "" Response.Write vbTab & vbTab & "" Response.Write vbTab & vbTab & "" Response.Write vbTab & vbTab & "
 "&day(rs("datahora"))&"-"&month(rs("datahora"))&"-"&year(rs("datahora"))&""&FormatStr(rs("titulo"))&"

"&FormatStr(rs("noticia"))&"
"& x &"
" Response.Write vbTab & vbTab & "
" 'Move to the next record! rs.MoveNext Loop 'Closing html table tag 'Response.Write "
" & vbCrLf ' Close all objects and clear from Memory rs.Close Set rs = Nothing %>
<% if flag=true then If strPageCurrent <> 1 Then Response.Write "" & vbCrLf 'Spacer - inside the if so we don't get it unless needed Response.Write "  " & vbCrLf End If If strPageCurrent < strPageCount Then Response.Write "" & vbCrLf End If else response.Write "Não existem anúncios publicados ...." end if %>
 
Qualidade
Ambiente
Saúde e
Segurança
Certificação de
Produtos
Certificação de
Serviços
Sistemas HACCP
Formação


contactos
anúncios
links
mapa do site