Jump to content
Fórum Script Brasil
  • 0



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



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

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


<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">


    <td bgcolor="#FFFFFF">

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


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



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




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



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



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



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

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



<%dim busca1



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">


                      <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 width="340"><div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Total

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



                      <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


response.write "Nehum registro encontrado"


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")%>



    <%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 >

                      <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%>




  <% 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">


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

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



          <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>


          <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>




                      <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")%>



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

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


            <%end if%>

                        </a> </td>




        <%end if%>


<% 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>





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









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.

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.

Cloud Computing

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...