Jump to content


shuase's Content

There have been 1 items by shuase (Search limited from 24/04/2023)


Ordernar por                Order  

#941140 Registros Vindos Aleatoriamente -urgente

Posted by shuase on 11/10/2008, 01:32 in ASP

Bom dia, achei aqui no site alguns comentários e explicações de como poderiam ser feitos a busca de registros vindo de banco de dados access e não consegui adaptar ao meu código.
Gostaria da ajuda de alguém.

Quero apresentar em uma página 6 registros que vem aleatoriamente do banco de dados em access para que a cada vez que a pessoa abra a página, ela mostre produtos diferentes.

vou colocar o codigo abaixo da página que existe:

@@@@@@@@@@@@@@@@@@@@@@@@@@@
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="conexao.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_cadastro_STRING
Recordset1.Source = "SELECT * FROM imobiliaria "

Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 11
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>


<%

'Senão encontrar nenhum registro '

	if Recordset1.eof then
		response.write "<p>&nbsp;<p><center><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><b>Não consta em nosso banco de dados nenhuma EMPRESAS neste período.</b></font></center>"
		
	else
%>

<html>
<head>
<title>Imobiliária RCM</title>
<style type="text/css">
<!--
.text {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strTextColour %>}
.bold {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strTextColour %>; font-weight: bold;}
.italic {font-family: <% = strTextType %>; font-size: <% = intTextSize - 1 %>px; color: #009900; font-style: italic;}
.heading {font-family: <% = strTextType %>; font-size: 24px; color: <% = strTextColour %>; font-weight: bold;}
a {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strLinkColour %>}
a:hover {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strHoverLinkColour %>}
a:visited {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strVisitedLinkColour %>}
a:visited:hover {font-family: <% = strTextType %>; font-size: <% = intTextSize %>px; color: <% = strHoverLinkColour %>}

-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="thf.css" rel="stylesheet" type="text/css">
</head>
<base target="_blank">
<center>
  <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" link="#000000" vlink="#000000" alink="#000000">
  <% 
While ((Repeat1__numRows <> 0)AND (NOT Recordset1.EOF)) 
%>



  <table width="100%" border="0" cellpadding="0" cellspacing="0" >
	<tr>
		
	  <td height="20"> <table width="100%" border="0" cellpadding="0" cellspacing="0" >
		  <tr> 
			<td height="20"> <div align="right">
				<table width="600" border="0" cellpadding="0" cellspacing="0" style="font-family: Tahoma; font-size: 8pt; color: #2E2E2E">
				  <tr>
					<td width="15%">
					<img src="<%=Recordset1("foto1")%>" width="80" height="80" align="right"></font></td>
 					<td width="68%"><b><%=Recordset1("tipo")%></b>&nbsp para &nbsp<%=Recordset1("finalidade")%> <br> <%=Recordset1("cidade")%>&nbsp-&nbsp<%=Recordset1("bairro")%><br> <%=Recordset1("valor")%></font></td>
					<td width="17%">
					<img border="0" src="dorm.gif" width="12" height="12" alt="Dormitórios">&nbsp<%=Recordset1("dormitorios")%></font><br>
					<br>
					<img border="0" src="garagem.gif" width="11" height="9">&nbsp<%=Recordset1("garagem")%><br>
					<br>
					<span style="text-decoration: none">
					<a href="#" onClick="window.open('pagina.asp?imobiliaria=<%=Recordset1("cod")%>&<%=Recordset1("foto1")%>','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,height=550,width=650'); return false;">Veja mais...</a></span></td>

					
				   </tr>
				 
				</table>
				
			  </div><hr>
			  </td>
		  </tr>
		</table>
		
	  </td>
	</tr>
  </table>
  <tr> 
	  
	<td width="50%" height="65" align="default"> 
	  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
	</td>
  </tr></body>
</center>
</html>
<%end if %>
<%
Recordset1.Close()
set conn = nothing
%>
@@@@@@@@@@@@@@@@@@@@@@@@@@@

Gostaria de adicionar nesse código a forma de fazê-lo abrir 6 registros sendo que se no banco de dados só houver 5, ele mostre somente 5.


Sou grato desde já pela atenção




IPB Skin By Virteq