Estou querendo exibir uma lista de clientes da empresa, onde esta lista está armazenada em MDB, consegui fazer a conexão com o BD, mas na hora de exibir a listagem, me é exibido apenas os 10 primeiros, os outros (que estariam nas próximas páginas), não são exibidos. Meu código está ficando assim:
<% @ LANGUAGE="VBSCRIPT" %>
<% Response.Expires = 0 %>
<%
Response.Expires = 0
'******* Conecta � Base de Dados
set conn = createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0; data source=" & server.mappath("/pages/bd.mdb")
set rs = createobject("adodb.recordset")
set rs.activeconnection = conn
'******* Carrega Parametro do Formul�rio
ini = Request.Querystring("ini")
rad = Request.Form("radio")
cid = Request.Form("cidade")
est = Request.Form("estado")
pai = Request.Form("pais")
img = Request.Form("logo")
web = Request.Form("site")
rad = replace(server.HTMLEncode(rad),"'","`")
cid = replace(server.HTMLEncode(cid),"'","`")
est = replace(server.HTMLEncode(est),"'","`")
pai = replace(server.HTMLEncode(pai),"'","`")
img = replace(server.HTMLEncode(img),"'","`")
web = replace(server.HTMLEncode(web),"'","`")
'******* Verifica e Inclui Novo Registo (inativo)
if (rad <> "" AND cid <> "" AND est <> "" AND pai <> "" AND img <> "" AND web <> "") then
sqli = "INSERT INTO clientes (radio,cidade,estado,pais,logo,site) VALUES ('" & rad & "','" & cid & "','" & est & "','" & pai & "','" & img & "','" & web & "')"
rs.open sqli
ini = 1
end if
'******* Inicializa Variaveis
ini = int(ini)
if ini <= 0 then ini = 1 end if
reg = 0
npg = 10
pgt = ini - 1
voltar = "Voltar"
'******* Consulta BD e lista Clientes
sql = "SELECT * FROM clientes WHERE estado='" & Request("estados") & "' "
rs.open sql
do while not rs.eof
reg = reg + 1
if rs("site") <> "" then
site = " - <a href='http://" & rs("site") & "'>[Site]</a>"
else
site = " - [Site]"
end if
if rs("logo") <> "" then
logo = "<img src=" &rs("logo") & " width='"40"' height='"40"'>"
end if
if reg >= ini AND reg <= ini+npg-1 then
pgt = pgt + 1
clientes = clientes & "<table width="200" border="0"> <tr> <th rowspan="2" scope="col">logo</th> <th scope="col">" & rs("radio") & "</th>
<th scope="col">" & site & "</th> </tr> <tr> <th colspan="2" scope="row">" & rs("cidade") & "," & rs("estado") & "-" & rs("pais") & "</th>
</tr></table>"
end if
rs.movenext
loop
if reg > ini+npg-1 then
proximo = " <a href='default.asp?ini=" & ini + npg & "'> [ Pr�ximos ]</a>"
else
proximo = " [ Pr�ximos ]"
end if
if ini-npg > 0 then
voltar = " <a href='default.asp?ini=" & ini - npg & "'> [ Anteriores ]</a>"
else
voltar = " [ Anteriores ]"
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nossos Clientes</title>
</head>
<body>
<tr>
<td align="middle" bgColor="#004184" colSpan="2" width="436">
<font face="Tahoma" style="font-size: 9pt">
<span style="COLOR: #CEE4F5"><b>Clientes - <% Response.Write est %></b>
</span>
</font>
</td>
</tr>
<% Response.Write clientes %>
<font face="Tahoma" style="font-size: 9pt" color="#004184"></font>
<tr bgColor="#ffffff">
<td width="150">
<font face="Tahoma" style="font-size: 9pt">
<span style="COLOR: #004184">
<b> Total: <% Response.Write reg %>
</b>
</span>
</font>
</td>
<td align="right" width="280">
<span style="FONT-SIZE: 13px; COLOR: black">
<% Response.Write ini & " a " & pgt & " - " & voltar & proximo %>
</span>
<span style="FONT-SIZE: 9pt; ">
<font color="#004184" face="Tahoma"><br>
</font>
</span>
</td>
</tr>
</body>
</html>
Pergunta
Paulo Faustini Jr
Estou querendo exibir uma lista de clientes da empresa, onde esta lista está armazenada em MDB, consegui fazer a conexão com o BD, mas na hora de exibir a listagem, me é exibido apenas os 10 primeiros, os outros (que estariam nas próximas páginas), não são exibidos. Meu código está ficando assim:
<% @ LANGUAGE="VBSCRIPT" %> <% Response.Expires = 0 %> <% Response.Expires = 0 '******* Conecta � Base de Dados set conn = createobject("adodb.connection") conn.open "provider=microsoft.jet.oledb.4.0; data source=" & server.mappath("/pages/bd.mdb") set rs = createobject("adodb.recordset") set rs.activeconnection = conn '******* Carrega Parametro do Formul�rio ini = Request.Querystring("ini") rad = Request.Form("radio") cid = Request.Form("cidade") est = Request.Form("estado") pai = Request.Form("pais") img = Request.Form("logo") web = Request.Form("site") rad = replace(server.HTMLEncode(rad),"'","`") cid = replace(server.HTMLEncode(cid),"'","`") est = replace(server.HTMLEncode(est),"'","`") pai = replace(server.HTMLEncode(pai),"'","`") img = replace(server.HTMLEncode(img),"'","`") web = replace(server.HTMLEncode(web),"'","`") '******* Verifica e Inclui Novo Registo (inativo) if (rad <> "" AND cid <> "" AND est <> "" AND pai <> "" AND img <> "" AND web <> "") then sqli = "INSERT INTO clientes (radio,cidade,estado,pais,logo,site) VALUES ('" & rad & "','" & cid & "','" & est & "','" & pai & "','" & img & "','" & web & "')" rs.open sqli ini = 1 end if '******* Inicializa Variaveis ini = int(ini) if ini <= 0 then ini = 1 end if reg = 0 npg = 10 pgt = ini - 1 voltar = "Voltar" '******* Consulta BD e lista Clientes sql = "SELECT * FROM clientes WHERE estado='" & Request("estados") & "' " rs.open sql do while not rs.eof reg = reg + 1 if rs("site") <> "" then site = " - <a href='http://" & rs("site") & "'>[Site]</a>" else site = " - [Site]" end if if rs("logo") <> "" then logo = "<img src=" &rs("logo") & " width='"40"' height='"40"'>" end if if reg >= ini AND reg <= ini+npg-1 then pgt = pgt + 1 clientes = clientes & "<table width="200" border="0"> <tr> <th rowspan="2" scope="col">logo</th> <th scope="col">" & rs("radio") & "</th> <th scope="col">" & site & "</th> </tr> <tr> <th colspan="2" scope="row">" & rs("cidade") & "," & rs("estado") & "-" & rs("pais") & "</th> </tr></table>" end if rs.movenext loop if reg > ini+npg-1 then proximo = " <a href='default.asp?ini=" & ini + npg & "'> [ Pr�ximos ]</a>" else proximo = " [ Pr�ximos ]" end if if ini-npg > 0 then voltar = " <a href='default.asp?ini=" & ini - npg & "'> [ Anteriores ]</a>" else voltar = " [ Anteriores ]" end if %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Nossos Clientes</title> </head> <body> <tr> <td align="middle" bgColor="#004184" colSpan="2" width="436"> <font face="Tahoma" style="font-size: 9pt"> <span style="COLOR: #CEE4F5"><b>Clientes - <% Response.Write est %></b> </span> </font> </td> </tr> <% Response.Write clientes %> <font face="Tahoma" style="font-size: 9pt" color="#004184"></font> <tr bgColor="#ffffff"> <td width="150"> <font face="Tahoma" style="font-size: 9pt"> <span style="COLOR: #004184"> <b> Total: <% Response.Write reg %> </b> </span> </font> </td> <td align="right" width="280"> <span style="FONT-SIZE: 13px; COLOR: black"> <% Response.Write ini & " a " & pgt & " - " & voltar & proximo %> </span> <span style="FONT-SIZE: 9pt; "> <font color="#004184" face="Tahoma"><br> </font> </span> </td> </tr> </body> </html>abs
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.