Forums

ASP

This topic is locked

Recordset HELP

Posted 31 Jan 2005 06:48:35
1
has voted
31 Jan 2005 06:48:35 Jaime Romo posted:
hello there i hope u guys undertand me beacuse i reallye need help...
i have a page with a recordset and a dinamic listmenu
the list menu displays de column [origen] from the database, but soime times it might be duplicated records.... so when the user click on the menu and if there is duplicated recors they will see record 1 twise.....how can i display only 1 record if there are duplicated records.....
thanks...
this is the code im using

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/avayaBanners.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_avayaBanners_STRING
Recordset1.Source = "SELECT * FROM conteo"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0">
<tr>
<td> <% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="100%" border="0">
<tr>
<td bgcolor="#CC0000"> <form name="form1" method="post" action="estadisticas2.asp">
<div align="center"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Ver
los resultados del banner en el sitio
<select name="resultado" id="resultado">
<%
While (NOT Recordset1.EOF)
%>
<option value="<%=(Recordset1.Fields.Item("origen".Value)%>"><%=(Recordset1.Fields.Item("origen".Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
<input type="submit" name="Submit" value="ver >>>">
</font></div>
</form></td>
</tr>
</table> <% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %> </td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


Visit my home page
www.cancuncoral.com

Replies

Replied 31 Jan 2005 11:23:06
31 Jan 2005 11:23:06 Lee Diggins replied:
Hi Jaime

Use SELECT DISTINCT instead.

Digga

Sharing Knowledge Saves Valuable Time!!!

Reply to this topic