Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

razs

[Resolvido] Nao repetir dados iguais

Recommended Posts

Bom ano pessoal.

 

Tenho aqui uma situação em que me mostra tudo o que tenho na bd para um campo, o problema é que esse campo as vezes repete-se e eu nao queria que aparece-se repetido.

 

Alguem me explica como fazer isso?

 

obr

 

<%
Session.TimeOut = 20
If Session("user") = "" Then
Response.Redirect "index.asp"
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">
<header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</header>
<%
Dim tbl2
Dim dir
tbl2= request.queryString("tbl2")
dir= request.queryString("dir")

set conn = CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.Oledb.4.0"
   conn.Open Server.MapPath("db/12345678.mdb")
set rs=server.createobject("adodb.recordset")
instotal = "select * from users ORDER BY " & tbl2 & " " & dir&""
rs.open instotal,conn,1,3

if rs.recordcount > 0 then 

%>
<body>
<div id="wrapper1">
<div id="wrapper2">
<div id="container">

       <div id="menu">
    	<ul>
		<li><a href="#" target="_parent">xxxxx</a></li>
           <li><a href="#" target="_parent">xxxxx</a></li>
		<li><a href="index.html" target="_parent">xxxxx</a></li>
           <li><a href="#">xxxxx</a></li>  
           <li><a href="#">xxxxx</a></li>   
          	<li><a href="#">xxxxx</a></li>            
       </ul>  
   </div>
   <br><br><br><br>
   <div id="header_banner">
   	<div id="header">
       	<div id="sitetitle">
           	<span></span>
		</div>
     <div id="tagline"></div>
       </div>
       <div id="banner">
       	<div id="bannertext">
           	<br /><span></span><br />
           </div>
		<%
		dim erro
		erro = request.queryString("erro")
		%>	
       </div>
   </div>

   <div id="content">

   	<div id="leftcolumn">
       	<div class="login_form">
       	<%
           If Session("user") = "" then 
           %>
          	<h1>Login</h1>

		<% response.write request.queryString("erro") %>

           <form method="post" action="login2.asp">
                   <div class="form_row"><label>Username</label><br><input name="user" type="text" class="inputfield" id="user" maxlength="60"/>
             </div>
                   <div class="form_row"><label>Password</label><br><input name="pass" type="password" class="inputfield" id="pass" maxlength="60"/>
             </div>
                   <br><input class="button" type="submit" name="Submit" value="Login" />
		  </form>

		  |<a href="recpass.asp" target="_self">Password Recovery</a>|
		  <%
		Else
		%>Welcome: <%Response.Write(Session("user"))%>
		<%
		if Session("user") = "admin" then 
		%>
		<br><a href="viewdata.asp" target="_self">View Data</a>  	|	<a href="viewstudy.asp" target="_self">View Studys</a>  	|	<a href="viewuser.asp?tbl2=username&dir=asc" target="_self">View User</a>  	|	
		<br><a href="reguser.asp" target="_self">Insert User</a>  	|	<a href="admin.asp" target="_self">Menu Admin</a>	|	<a href="fechar.asp">Log off</a>
		<%
		else
		%>
		<br><a href="adddata.asp">Insert Data</a>	|	<a href="fechar.asp">Log off</a>	| 
		<%
		end if			
		End if
		%> 
		</div>

           <div class="spacetobottom"></div>  

       </div>







       <div id="rightcolumn">

       	<div class="treecolumn">



		<h4>View Users</h4>
		<br>
		<br>Username<a href="viewuser.asp?tbl2=username&dir=asc"><img src="images/up.jpg"></a>	
		<a href="viewuser.asp?tbl2=username&dir=desc"><img src="images/down.jpg"></a>		
		<%
		if RS.RecordCount < 1 then
		response.write "No user was found"
		else

		DIM intPageRecords, intRecords, intRecordCount, intCurrentPage
		DIM intNumberOfPages, intDisplayPage
		intPageRecords = Request.Querystring("page")
		IF intPageRecords = "" THEN intPageRecords = 1 : intRecords = 1
		intRecords = intPageRecords
		intPageRecords = ((intPageRecords - 1) * 10) +1
		intRecordCount = 0

		IF NOT RS.EOF THEN
		RS.Move (intPageRecords - 1)
		DO WHILE intRecordCount < 10 and NOT RS.EOF
		%>

		<br>				
		<a href="generalview.asp?tbl=username&tbl1=<%=rs.fields("username")%>"><b><%=rs.fields("username")%></b></a>
		<a href="generalview.asp?tbl=study&tbl1=<%=rs.fields("study")%>"><b><%=rs.fields("study")%></b></a>
		<a href="generalview.asp?tbl=center&tbl1=<%=rs.fields("center")%>"><b><%=rs.fields("center")%></b></a>

		<%
		RS.MoveNext
		intRecordCount = intRecordCount +1
		Loop
		END IF
		%>
		<br><br><br>
		<%=intPageRecords%> - <%=intPageRecords+(intRecordCount-1)%> of <%=(RS.RecordCount)%> Users
		<%
		intCurrentPage = Request.Querystring("page")
		IF intCurrentPage = "" THEN intCurrentPage = 1
		intNumberOfPages = int(RS.RecordCount \ 10)
		IF RS.RecordCount MOD 10<> 0 THEN intNumberOfPages = intNumberOfPages + 1
		Response.Write("There are [")
		FOR intDisplayPage = 1 TO intNumberOfPages
		IF Cint(intDisplayPage) = Cint(intCurrentPage) THEN
		Response.Write " <b>" & intDisplayPage & "</b> "
		ELSE

		Response.Write " <a href=""viewuser.asp?tbl2=" &request.queryString("tbl2")& "&dir=" &request.queryString("dir")& "&page=" & intDisplayPage & """>" & intDisplayPage &"</a> "

		END IF
		NEXT
		Response.Write ("]")
		end if

		end if
		if RS.RecordCount <10 then
		else
		end if
		%>
	  </div>	

		<div class="spacetobottom"></div>         

       </div>  

</div>

   <div id="footer">
       <a href="#">Home</a> | <a href="#">xxxxxxxxxx</a> | <a href="#">xxxxxxxxxx</a> | <a href="#">xxxxxxx</a> | <a href="#">xxxxxxx</a> | <a href="#">Contacts</a><br />
       Copyright © 2012 <a href="#"><strong>xxxxxxxxxxxxxx</strong></a> 

       </div>
   </div>

</div> 
</div> 
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

resolvido :)

bastou mudar o select para

 

select nome_study from studys group by nome_study order by nome_study " & dir&""

 

obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.