Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

gspereira

[Resolvido] Either BOF or EOF is True, or the current record has

Recommended Posts

tenho essa mensagem quando a busca nao tem resultados. se tem resultado, funciona.

alguém pode me ajudar?

agradeço imensamente!!!!

 

codigo:

 

<%@LANGUAGE="VBSCRIPT"%> 

<!--#INCLUDE FILE="topo.asp" -->
<!--#INCLUDE FILE="barra.asp" -->
<!--#INCLUDE FILE="publicite.asp" -->
<%
Dim Recordset__MMColParam
Recordset__MMColParam = "1"
if (Request.QueryString("pesquisa") <> "") then Recordset__MMColParam = Request.QueryString("pesquisa")
%>

<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.CursorLocation = 3 ' adUseClient
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\inetpub\vhosts\malipages.com\httpdocs\bd1.mdb"

set Recordset = Server.CreateObject("ADODB.Recordset")
Recordset.ActiveConnection =  conn
Recordset.Source = "SELECT *  FROM societes  WHERE societe LIKE '%" + Replace(Recordset__MMColParam, "'", "''") + "%'  ORDER BY logo desc, texte desc, hebergement desc, web desc, email desc, societe asc"
Recordset.CursorType = 0
Recordset.CursorLocation = 2
Recordset.LockType = 3
Recordset.Open()

Recordset_numRows = 0



%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 10
Dim Repeat1__index
Repeat1__index = 0
Recordset_numRows = Recordset_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
Recordset_total = Recordset.RecordCount

' set the number of rows displayed on this page
If (Recordset_numRows < 0) Then
  Recordset_numRows = Recordset_total
Elseif (Recordset_numRows = 0) Then
  Recordset_numRows = 1
End If

' set the first and last displayed record
Recordset_first = 1
Recordset_last  = Recordset_first + Recordset_numRows - 1

' if we have the correct record count, check the other stats
If (Recordset_total <> -1) Then
  If (Recordset_first > Recordset_total) Then Recordset_first = Recordset_total
  If (Recordset_last > Recordset_total) Then Recordset_last = Recordset_total
  If (Recordset_numRows > Recordset_total) Then Recordset_numRows = Recordset_total
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (Recordset_total = -1) Then

  ' count the total records by iterating through the recordset
  Recordset_total=0
  While (Not Recordset.EOF)
    Recordset_total = Recordset_total + 1
    Recordset.MoveNext
  Wend
  
 
  

  ' reset the cursor to the beginning
  If (Recordset.CursorType > 0) Then
    Recordset.MoveFirst
  Else
    Recordset.Requery
  End If

  ' set the number of rows displayed on this page
  If (Recordset_numRows < 0 Or Recordset_numRows > Recordset_total) Then
    Recordset_numRows = Recordset_total
  End If

  ' set the first and last displayed record
  Recordset_first = 1
  Recordset_last = Recordset_first + Recordset_numRows - 1
  If (Recordset_first > Recordset_total) Then Recordset_first = Recordset_total
  If (Recordset_last > Recordset_total) Then Recordset_last = Recordset_total

End If
%>
<%
' *** Move To Record and Go To Record: declare variables

Set MM_rs    = Recordset
MM_rsCount   = Recordset_total
MM_size      = Recordset_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
  MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter

if (Not MM_paramIsDefined And MM_rsCount <> 0) then

  ' use index parameter if defined, otherwise use offset parameter
  r = Request.QueryString("index")
  If r = "" Then r = Request.QueryString("offset")
  If r <> "" Then MM_offset = Int(r)

  ' if we have a record count, check if we are past the end of the recordset
  If (MM_rsCount <> -1) Then
    If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last
      If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' move the cursor to the selected record
  i = 0
  While ((Not MM_rs.EOF) And (i < MM_offset Or MM_offset = -1))
    MM_rs.MoveNext
    i = i + 1
  Wend
  If (MM_rs.EOF) Then MM_offset = i  ' set MM_offset to the last possible record

End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range

If (MM_rsCount = -1) Then

  ' walk to the end of the display range for this page
  i = MM_offset
  While (Not MM_rs.EOF And (MM_size < 0 Or i < MM_offset + MM_size))
    MM_rs.MoveNext
    i = i + 1
  Wend

  ' if we walked off the end of the recordset, set MM_rsCount and MM_size
  If (MM_rs.EOF) Then
    MM_rsCount = i
    If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount
  End If

  ' if we walked off the end, set the offset based on page size
  If (MM_rs.EOF And Not MM_paramIsDefined) Then
    If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
      If ((MM_rsCount Mod MM_size) > 0) Then
        MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
      Else
        MM_offset = MM_rsCount - MM_size
      End If
    End If
  End If

  ' reset the cursor to the beginning
  If (MM_rs.CursorType > 0) Then
    MM_rs.MoveFirst
  Else
    MM_rs.Requery
  End If

  ' move the cursor to the selected record
  i = 0
  While (Not MM_rs.EOF And i < MM_offset)
    MM_rs.MoveNext
    i = i + 1
  Wend
End If
%>
<%
' *** Move To Record: update recordset stats

' set the first and last displayed record
Recordset_first = MM_offset + 1
Recordset_last  = MM_offset + MM_size
If (MM_rsCount <> -1) Then
  If (Recordset_first > MM_rsCount) Then Recordset_first = MM_rsCount
  If (Recordset_last > MM_rsCount) Then Recordset_last = MM_rsCount
End If

' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
  NextItem = "&" & Item & "="
  If (InStr(1,MM_removeList,NextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "")  Then MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links

MM_keepMove = MM_keepBoth
MM_moveParam = "index"

' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 0) Then
  MM_moveParam = "offset"
  If (MM_keepMove <> "") Then
    params = Split(MM_keepMove, "&")
    MM_keepMove = ""
    For i = 0 To UBound(params)
      nextItem = Left(params(i), InStr(params(i),"=") - 1)
      If (StrComp(nextItem,MM_moveParam,1) <> 0) Then
        MM_keepMove = MM_keepMove & "&" & params(i)
      End If
    Next
    If (MM_keepMove <> "") Then
      MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
    End If
  End If
End If

' set the strings for the move to links
If (MM_keepMove <> "") Then MM_keepMove = MM_keepMove & "&"
urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = urlStr & "0"
MM_moveLast  = urlStr & "-1"
MM_moveNext  = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev  = urlStr & Cstr(prev)
%> <%
'Auto Hyperlink by Tom Steeper 2001 v1.0.3	
Function MakeHyperlink(strSource)	
	
	if (strSource <> "") or Not IsNull(strSource) then
		splitSource = Split(strSource," ")
		linkResult = Filter(splitSource, "www", True)
		emailResult = Filter(splitSource, "@", True)
		
		For i = 0 to Ubound (splitSource)
			MakeHyperLink = MakeHyperlink & splitSource(i) & " "
		Next
	
		For i = 0 to Ubound (linkResult)
			'Trim off any punctuation
			If Right(linkResult(i),1) = "," OR Right(linkResult(i),1) = "." then
				linkResult(i)=left(linkResult(i),len(linkResult(i))-1)
			End If
			If Left(linkResult(i),7) = "http://" OR Left(linkResult(i),7) = "HTTP://" then
				linkWrapTag = "<a href=" & linkResult(i) & ">" & linkResult(i) & "</a>"
			Else
				linkWrapTag = "<a href=http://" & linkResult(i) & ">" & linkResult(i) & "</a>"
			End If
			MakeHyperLink = Replace(MakeHyperLink, linkResult(i), linkWrapTag)
		Next
	
		For i = 0 to Ubound (emailResult)
			'Trim off any punctuation
			If Right(emailResult(i),1) = "," OR Right(emailResult(i),1) = "." then
				emailResult(i)=left(emailResult(i),len(emailResult(i))-1)
			End If
			emailWrapTag = "<a href=mailto:" & emailResult(i) & ">" & emailResult(i) & "</a>"
			MakeHyperLink = Replace(MakeHyperLink, emailResult(i), emailWrapTag)
		Next
	
		MakeHyperLink = Replace(MakeHyperLink,Chr(13),"<br>")
	
	Else
		MakeHyperlink = strSource
	End If
	
End Function
%> <html> <head> <title>RESULTATS DE VOTRE RECHERCHE - MALIPAGES.COM 
PAGES JAUNES DU MALI, ANNUAIRE DU MALI, OPPORTUNITES D'AFFAIRES, OFFRES D'EMPLOI 
</title> <BR><BR>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="left">
        <tr> 
          <td align="center" height="362" valign="top" width="160"> 
            <div align="center"> 
              <!--#include file="pub.asp" -->
            </div>
          </td>
          <td height="362" valign="top" width="800"> 
            <p><span class="texto"><b><%=(Recordset_total)%> entreprise(s) trouvée(s).</b></span><span class="texto"> 
              <b><br>
              <br>
              </b></span></p>
            <div align="left"> 
              <% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset.EOF)) 

%>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td bgcolor="#DEDEED"> 
                    <div align="left"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"><b>Société: 
                      </b></span><%=(Recordset.Fields.Item("societe").Value)%></span></span></span></span></span></span></span></span></span></div>
                  </td>
                </tr>
              </table>
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="90%" align="left" valign="top"> 
                    <div align="left"><span class="texto"><b>Adresse:</b> <%=(Recordset.Fields.Item("rue").Value)%> 
                      - <%=(Recordset.Fields.Item("numero").Value)%> <%=(Recordset.Fields.Item("ville").Value)%> 
                      - MALI<br>
                      <b>Téléphone:</b> +223 <%=(Recordset.Fields.Item("telephone").Value)%> 
                      <b>Fax: </b>+223 <%=(Recordset.Fields.Item("fax").Value)%> 
                      <br>
                      <b>E-mail:</b> </span><%=MakeHyperlink((Recordset.Fields.Item("email").Value))%><span class="texto"><b>Web: 
                      </b><a href="<%=(Recordset.Fields.Item("web").Value)%>" target="_blank"><%=(Recordset.Fields.Item("web").Value)%></a><br>
                      </span><span class="texto"><b><%=(Recordset.Fields.Item("Texte").Value)%></b></span></div>
                  </td>
                  <td width="10%"> 
                    <div align="RIGHT"><span class="texto"><span class="texto"><a href="redirect.asp?id=&url=" target="_blank"> 
                      </a></span><span class="texto"><span class="texto"><span class="texto"><span class="texto"><span class="texto"></span></span></span></span></span><span class="texto"><span class="texto"><span class="texto"><span class="texto"> 
                      <%Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
objFile = Request.ServerVariables("SCRIPT_NAME")
ImagePath = Server.MapPath("/logos/")
ImagePath = ImagePath & "/" & (Recordset.Fields.Item("Logo").Value)
If objFileSystem.FileExists(ImagePath) then%>
                      <img src="http://www.malipages.com/logos/<%=(Recordset.Fields.Item("Logo").Value)%>" border="0"> 
                      <%End If%>
                      </span></span></span></span></span></div>
                  </td>
                </tr>
              </table>
              <br>
              <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset.MoveNext()
Wend
%>


            </div>
            <p align="left"><span class="texto">Pages de Resultats</span><span class="texto"> 
              : 
              <% TM_navLinks=0
If MM_offset <> 0 Then 
  Response.Write("<A HREF=""" & MM_moveFirst & """></A>") 
  else
  Response.Write("")
  End If 
 Response.Write(" ") 
If MM_offset <> 0 Then 
 Response.Write("<A HREF=""" & MM_movePrev & """>Précédent</A>") 
else
  Response.Write("Précédent")
End If
   Response.Write(" ") 
If Not MM_atTotal Then 
  Response.Write("<A HREF=""" & MM_moveNext & """></A>") 
  else 
  Response.Write("")
 End If
   Response.Write(" ")
If Not MM_atTotal Then
  Response.Write("<A HREF=""" & MM_moveLast & """></A>") 
  else
  Response.Write("")
End If
 %>
              <%
TM_counter = 0
For i = 1 to Recordset_total Step MM_size
TM_counter = TM_counter + 1
TM_PageEndCount = i + MM_size - 1
if TM_PageEndCount > Recordset_total Then TM_PageEndCount = Recordset_total
if i <> MM_offset + 1 then
Response.Write("<a href=""" & Request.ServerVariables("URL") & "?" & MM_keepMove & "offset=" & i-1 & """>")
Response.Write(TM_counter & "</a>")
else
Response.Write("<b>" & TM_counter & "</b>")
End if
if(TM_PageEndCount <> Recordset_total) then Response.Write(" ")
next
 %>
              <% TM_navLinks=0
If MM_offset <> 0 Then 
  Response.Write("<A HREF=""" & MM_moveFirst & """></A>") 
  else
  Response.Write("")
  End If 
 Response.Write(" ") 
If MM_offset <> 0 Then 
 Response.Write("<A HREF=""" & MM_movePrev & """></A>") 
else
  Response.Write("")
End If
   Response.Write(" ") 
If Not MM_atTotal Then 
  Response.Write("<A HREF=""" & MM_moveNext & """>Suivant</A>") 
  else 
  Response.Write("Suivant")
 End If
   Response.Write(" ")
If Not MM_atTotal Then
  Response.Write("<A HREF=""" & MM_moveLast & """></A>") 
  else
  Response.Write("")
End If
 %>
              </span> </p>
            <p align="left"> </p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td> 
      <!--#include file="bas.asp" -->
    </td>
  </tr>
</table>

</body>
</html>
<%
Recordset.Close()
%>
<%
' BUD Destroy Recordset
Set Recordset = Nothing
%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

qual a linha do erro exatamente?

Compartilhar este post


Link para o post
Compartilhar em outros sites

qual a linha do erro exatamente?

 

 

nao sei

mesmo desativando a opcao de erros simplificados aparece "500 internal server error"

e no log:

 

2010-03-05 23:22:01 W3SVC6682 HEB49155 213.246.49.155 GET /results1.asp pesquisa=xxx|466|800a03f6|'End'_attendu 80 - 187.67.154.166 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0;+OfficeLiveConnector.1.3;+OfficeLivePatch.0.0) ASPSESSIONIDAQTDSQQA=CNJJCBPDGMELDBJHDNAPCOOO;+ASPSESSIONIDASRDTRRA=NIBPANLAEBCKAOCKNMLHKPMC http://www.malipages.com/ www.malipages.com 500 0 0 1616 517 242

Compartilhar este post


Link para o post
Compartilhar em outros sites

Isso não ajudou muito. Você está utilizando Windows Vista/Seven?

 

Tem que habilitar para mostrar a mensagem corretamente, pois seu código é muito extenso para ser analisado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

vendo a linha de erro descobri que o erro esta neste bloco:

 

' reset the cursor to the beginning
  If (Recordset.CursorType > 0) Then
    Recordset.MoveFirst
  Else
    Recordset.Requery
  End If

Compartilhar este post


Link para o post
Compartilhar em outros sites

Sempre antes de acessar o Recordset (avancar ou voltar, acessar campos, etc), você tem que verificar se ele é verdadeiro.

 

Exemplo:

If Not Recordset.Eof Then
'Quer dizer, se não for fim de arquivo, então continua aqui dentro
Else
'Fim de arquivo. Nenhum registro encontrado.
End If

Compartilhar este post


Link para o post
Compartilhar em outros sites

Sempre antes de acessar o Recordset (avancar ou voltar, acessar campos, etc), você tem que verificar se ele é verdadeiro.

 

Exemplo:

If Not Recordset.Eof Then
'Quer dizer, se não for fim de arquivo, então continua aqui dentro
Else
'Fim de arquivo. Nenhum registro encontrado.
End If

 

Pode me ajudar me sugerindo onde colocar? pois ja tentei isso em varios lugares e nao deu certo...

Compartilhar este post


Link para o post
Compartilhar em outros sites

If Not Recordset.Eof Then
'Quer dizer, se não for fim de arquivo, então continua aqui dentro
' reset the cursor to the beginning
If (Recordset.CursorType > 0) Then
Recordset.MoveFirst
Else
Recordset.Requery
End If 
Else
'Fim de arquivo. 
response.write "Nenhum registro encontrado."
End If

algo assim

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.