Ir para conteúdo
Fórum Script Brasil
  • 0

O Que Acontece?


marcos_804

Pergunta

AQUI VAI MEU CODIGO, OU MELHOR, O QUE TENTEI ADAPTAR PARA O MEU SITE

sad.gif

<% Option Explicit %>

<% Response.Buffer = True %>

<%

'Dimension variables

Dim adoCon    'Database Connection Variable

Dim rsLivro  'Database Recordset Variable

Dim strCon  'Holds the Database driver and the path and name of the database

Dim strAccessDB  'Holds the Access Database Name

Dim strSQL    'Database query sring

Dim strPreviousPollQuestion 'Holds the previous Weekly Poll Questions

Dim intPreviousPollQuestionID 'Holds the previous weekly poll questions Id Number

Dim dtmPreviousPollQuestionDate 'Holds the date the previous weekly poll is from

Dim intRecordPositionPageNum  'Holds the record position of the previous Poll Titles to display

Dim intRecordLoopCounter 'Loop counter for displaying the previous polling questions

'Declare constants

' ------------- Change the following line to the number of previous Poll Question Titles you wish to have displayed on each page -------

Const intRecordsPerPage = 2  'Change this number to the number of previous Poll Question Titles to be displayed on each page

'----------------------------------------------------------------------------------------------------------------------------------------------

'Read in the previous poll question titles to display from the database

'If there is no previous titles to display from then start at the last question titles in the database

If Request.QueryString("PaginaAtual") = "" Then

intRecordPositionPageNum = 1

'Else the page has been displayed before so the previous Poll Question Titles record postion is set to the Record Position number

Else

intRecordPositionPageNum = CInt(Request.QueryString("PaginaAtual"))

End If

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Teste de Pagina&ccedil;&atilde;o do livro de visitas</title>

<style>

a{text-decoration:none;font-family:verdana;font-weight:bold}

a:hover{text-decoration:underline;font-weight:normal}

</style>

<!-- The Surf-Net Weekly Poll is written and produced by Bruce Corkhill 2001

      If you want your own Weekly Poll then goto http://www.surf-net.co.uk -->

     

</head>

<body bgcolor="#336699" text="#FFFFFF" link="#66CCFF" vlink="#66CCFF" alink="#FF0000">

<div align="center">

  <table width="370" border="0" cellspacing="0" cellpadding="1">

    <%

'Initialise the strAccessDB variable with the name of the Access Database

strAccessDB = "banco"

'Create a connection odject

Set adoCon = Server.CreateObject("ADODB.Connection")

Set rsLivro = Server.CreateObject("ADODB.Recordset")

   

'Open connection to the database driver

strCon="DRIVER={Microsoft Access Driver (*.mdb)};"

 

'Open Connection to database

strCon = strCon & "DBQ=" & Server.MapPath(strAccessDB)

'Initalise the strSQL variable with an SQL statement to query the database

strSQL = "SELECT * FROM livro ORDER By id DESC"

'Query the database

rsLivro.Open strSQL, strCon, 3

'Set the number of previous Poll Question Titles to display on each page by the constant set at the top of the script

rsLivro.PageSize = intRecordsPerPage

'Get the previous Weekly Poll Titles record poistion to display from

If NOT rsLivro.EOF Then rsLivro.AbsolutePage = intRecordPositionPageNum

' loop through the previous poll questions in the database and display HTML hyperlinks to them

For intRecordLoopCounter = 1 to intRecordsPerPage

'If there are no more previous Poll Question records left to display then exit loop

If rsLivro.EOF Then Exit For

'Read in the date the poll is from

email = rsLivro("email")

mensagem = rsLivro("mensagem")

'Write the HTML to display links to all the previous Poll Question Titles

Response.Write vbCrLf & "  <tr>"

Response.Write vbCrLf & "        <td width=""250"">Nome: <br><br>E-mail:" & email & "<br><br>Mensagem:<br>" & mensagem & "</td>"

Response.Write vbCrLf & "  </tr>"

'Move to the next record

rsLivro.MoveNext

Next

%>

  </table>

  <br>

  <!-- Table to display next and previous links for other previous weekly poll questions -->

  <table width="370" border="0" cellspacing="1" cellpadding="1" align="center" height="21">

    <tr align="center">

      <td align="left" width="83">

        <%

     

'If the previous Poll Question Titles page number is higher than page 1 then display a back link   

If intRecordPositionPageNum > 1 Then

Response.Write " <a href=""testeDePaginacao.asp?PaginaAtual=" &  intRecordPositionPageNum - 1  & """ target=""_self"">&lt;&lt;&nbsp;Prev</a>"         

End If

     

      %>

      </td>

      <td width="201">

        <%

     

'If there are more previous Poll Question Titles to display then add a title to the other pages

If intRecordPositionPageNum > 1 or NOT rsLivro.EOF Then

Response.Write " Anterior do livro"

End If

     

      %>

      </td>

      <td align="right" width="76">

        <%

     

'If it is Not the End of the previous Poll Question Titles entries then display a next link for the next previous Poll Question Titles page     

If NOT rsLivro.EOF then   

Response.Write " <a href=""testeDePaginacao.asp?PaginaAtual=" &  intRecordPositionPageNum + 1  & """ target=""_self"">Next&nbsp;&gt;&gt;</a>"   

End If

'Reset Server Objects

Set adoCon = Nothing

rsLivro.Close

Set rsLivro = Nothing     

     

      %>

      </td>

    </tr>

  </table>

  <br>

  <a href="JavaScript:window.close()">Fechar esta janela</a><br>

  <br>

</div>

</body>

</html>

E ESTE É O MALDITO ERRO

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'email'

/teajudo/S TESTES/testeDePaginacao.asp, line 88

AJUDEM!!!!!!!

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...