• 0
Sign in to follow this  
ju_rezende

Duvida

Question

Olaá pessoal fiz um codio de busca que me mosta o tatal de registro, ma ele esta mostrando o total de registro do banco e não do resultado de registro que encontrou....será que alguém poderia me dar uma ajudinha?

Vou por meu codigo aqui

<html>

<head>

<title>Comércio de Jacareí</title>

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

</head>

<body background="../imagem/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="779" border="0" align="center" cellpadding="0" cellspacing="0" id="setores">

  <tr>

    <td bgcolor="#FFFFFF">

<table id="setores" width="779" height="864" border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td width="779" height="33"><!--#include file="topo01.html"--></td>

</tr>

<tr>

  <td width="779" height="81"><!--#include file="topo02.asp"--></td>

</tr>

<tr>

 

  <td width="779" height="86" background="../imagem/bg_topo3.gif" ><!--#include file="topo3.html"--> </td>

</tr>

<tr>

  <td width="779" height="14" bgcolor="#8DB5AF"></td>

</tr>

<tr>

  <td width="779" height="3" bgcolor="#FFFFFF"></td>

</tr>

<tr>

    <td width="779" height="625" Valign="top" align="center">

<table width="770" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td>

<%dim busca1

 

busca1=trim(request.form("NomeBusca"))

sql2 = "select * from clientes where Endereco  like '%" & busca1 & "%' and del=0 order by empresa"

'db = server.MapPath ("dados\treino.mdb")

'set con = server.CreateObject("adodb.connection")

'con.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("..\dados\treino.mdb") &";Persist Security Info=False"

set rs2 = server.CreateObject ("adodb.recordset")

                     

 

rs2.Open sql2,con,3,3 %>

<table id="lojamostra"width="770" border="0" cellspacing="0" cellpadding="0">

        <tr>

                      <td height="28"><font size="2" face="Arial, Helvetica, sans-serif"><a href="default.asp">Home</a></font>

                        <font size="2" face="Arial, Helvetica, sans-serif"><a href="default.asp">Voltar</a></font>

                      </td>

          <td width="340"><div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Total

                          de registros</strong></font> <%=rs2.recordcount%> </div></td>

        </tr>

        <tr>

                      <td colspan="2" align="center">

                        <%dim sql

if request.form("bairro")<>"Bairro" then

sql=" And  Bairro = '" & request.form("Bairro") & "'"

elseif request.form ("Categoria")<> "Categoria" then

sql=" And Categoria = '" & request.form("Categoria") & "'" & sql

elseif request.form ("Empresa") <> "" then

sql=" And Empresa like '%" & trim(request.form("Empresa")) & "%'" & sql

else

response.write "Nehum registro encontrado"

response.end

end if%>

                        <%set rs2 = server.CreateObject ("adodb.recordset")

rs2.Open "select * from clientes where del = 0 " & sql & " order by empresa",con,3,3 %>

        <%Dim Bairro%>

        <% Dim categoria%>

        <%Dim Empresa %>

        <% Bairro=request.form("Bairro")%>

        <% Categoria=request.form("Categoria")%>

        <%Empresa=request.form("Empresa")

%>

    <%if rs2.eof=true then %>

    <font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><strong> <%response.write " Nenhum registro encontrado"%></strong></font></td>

        </tr>

  <%else%>

 

                    <tr >

                      <td colspan="2" background="../imagem/fundodaTd.gif"><font color="#990000" size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#990000" size="2" face="Arial, Helvetica, sans-serif">Pesquisa

                        por </font> &gt;&gt; </strong><font color="#990000">Bairro</font><strong>

                        <%response.write Bairro%>

                        </strong></font>&gt;&gt; <font color="#990000">Categoria

                        <font color="#000000">&gt;&gt;</font> <%response.write Categoria %>

                        Por Nome <font color="#000000">&gt;&gt;</font> <%response.write Empresa%>

                        </font></td>

        </tr>

 

  <% do while not rs2.eof%>

                    <tr >

                      <td colspan="2" background="../imagem/fundodacinza.gif"> <font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><strong>Empresa:</strong></font><font color="#990000" size="2" face="Arial, Helvetica, sans-serif">

                        <strong> <font color="#990000" size="2" face="Arial, Helvetica, sans-serif">

                        <strong>

                        <%response.write rs2("Empresa")%>

                        </strong></font> </strong></font></td>

        </tr>

        <tr>

          <td><font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><strong>Endere&ccedil;o:

            </strong></font><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">

            <font color="#000000" size="2" face="Arial, Helvetica, sans-serif"><% response.write rs2("Endereco")%></font>

            </font></td>

          <td><strong><font color="#000000" size="2">Bairro: </font></strong>

            <font color="#000000" size="2" face="Arial, Helvetica, sans-serif">

            <font color="#000000" size="2" face="Arial, Helvetica, sans-serif"> <% response.write rs2("Bairro")%></font>

            </font></td>

        </tr>

        <tr>

                      <td height="23" valign="top"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Telefone:

                        (12)</strong></font><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">

                        <% response.write rs2("Telefone")%>

                        </font> </td>

                      <td valign="top"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Site:</strong></font>

                        <font size="2" face="Arial, Helvetica, sans-serif">: </font>

                        <% if rs2("site")<>"-" then%>

            <a href ="Http://<%=rs2("site")%>"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">

            <%response.write rs2("Site")%>

            </font>

            <%else%>

            </a><a href ="NaoSite.asp"><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">

            <%response.write rs2("Site")%>

            </font>

            <%end if%>

                        </a> </td>

        </tr>

  <%rs2.movenext%>

        <%loop%>

        <%end if%>

</table>

<% if con.state <> 0 then con.Close

If rs.state <> 0 Then rs.close

If rs2.state <> 0 Then rs2.close

If rs1.state <> 0 Then rs1.close

set con= Nothing

set rs = Nothing

set rs1 = Nothing

set rs2 = Nothing%></td>

  </tr>

</table></td>

</tr>

<tr>

  <td width="779" height="22"></td>

</tr>

</table>

</td>

  </tr>

</table>

</body>

</html>

abraços

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this