Ir para conteúdo

POWERED BY:

Arquivado

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

Christiano Nunes

Porque os registros estao repetidos?

Recommended Posts

Pessoal como não consegui resolver meu problema com o script

de agenda.. (tópico anterior), resolvi adaptar um script de calendário

já pronto.. mas só está faltando uma coisa pra concluir

 

Para cada dia existe um compromisso diferente, compromisso este

que é buscado no banco de dados ACCESS.. mas não sei porque

está pegando registros iguais... o While - wend, está dentro do For - next..

será que é por causa disso? como fazer?

 

FUNÇOES

<%		function formatData(data)dim dia, mês, ano, b1, b2, hora, espacoformatData = ""if not isdate(data) then exit functionb1 = instr(1,data,"/")b2 = instr(b1+2,data,"/")espaco = instr(1,data," ")dia = left(data,b1-1)if len(dia)<>2 then dia = "0" & diamês = mid(data,b1+1,2)if not isnumeric(mês) then mês = "0" & left(mês,1)if espaco>0 thenano = mid(data,b2+1,espaco-(b2+1))elseano = mid(data,b2+1)end ifif len(data)>10 then hora = formatdatetime(data,3)formatData = trim(dia & "/" & mês & "/" & ano & " " & hora)end function 	   %>	  	  <%	Public Function nomesemana(nome)	   	Select Case nome	   	Case 1	nomesemana = "DOMINGO"	Case 2	nomesemana = "SEGUNDA"	Case 3	nomesemana = "TERÇA"	Case 4	nomesemana = "QUARTA"	Case 5	nomesemana = "QUINTA"	Case 6	nomesemana = "SEXTA"	Case 7	nomesemana = "SÁBADO"	End Select	End Function			  	%>
VARIÁVEIS DO CALENDARIO

 

<%dim dt 'Variável que controla a Dataif request("dt") = empty thendt = date() 'Traz dataelsedt = request("dt")end ifdim pd 'Variável do primeiro diadim ud 'Variável do último diapd = DateSerial(year(dt),month(dt),1)ud = DateSerial(year(dt),month(dt)+1,1)-1dim ma 'Mês anterior ao atualdim mp 'Mês posterior ao atualma = DateSerial(year(dt),month(dt)-1,1) 'Para voltar 1 mêsmp = DateSerial(year(dt),month(dt)+1,1) 'Para andar 1 mês'-------------------------'Montagem da Grade de Dias'-------------------------dim gr(36) 'Matrizdim li 'Linhas da Gradedim co 'Colunas da Gradedim ct 'Contador da Gradect = 1dim lp 'Suporte aos Loops'-------------------------'Montagem dos Quadros Brancos'-------------------------for lp = 1 to weekday(pd)- 1gr(ct) = " "ct = ct + 1next'-------------------------'Lendo o Mês Atual'-------------------------for lp = pd to udif lp = date thengr(ct) = "<font color = red>" & day(lp) & "</font>"elsegr(ct) = day(lp)end ifct = ct + 1next'-----------------------------'Montagem do Resto dos Quadros'-----------------------------for lp = ct to 36gr(lp) = " " 'Coloquei LP dentro do GR porque ele já'tem o valor de CT (que é a posição'do último dia + 1)next ct = 1%>
ESCREVENDO O CALENDARIO NA TELA

 

<table width="100%" border=1 cellspacing = 0>		<tr>		  <td bgcolor="#4DA8E1"><a href= "index_ger2.asp?dt=<%=ma%>"> <img src="../imagens/jpg/rev.jpg" alt="Mês anterior" width="32" height="32" border="0"></a></td>		  <td colspan = 4 align = center bgcolor="#4DA8E1"><font face = "verdana" size = 3><b> <%=Ucase(MonthName(month(dt),true))%>/<%=year(dt)%> </b></font></td>		  <td align="right" bgcolor="#4DA8E1"><a href = "index_ger2.asp?dt=<%=mp%>"><img src="../imagens/jpg/fw.jpg" alt="Próximo mês" width="32" height="32" border="0"></a></td>		</tr>	  </table>		<table width="100%" border=1 cellspacing = 0>		<%for li = 1 to 9%>		<tr>		  <%for co = 1 to 4%>		  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">			  <tr>				<th width="100%" bgcolor="#CCCCCC" scope="row"><div align="left" class="style29">				 <%		  diasemanahoje = nomesemana(WeekDay(ct))		  response.write diasemanahoje		  %>	  				</div></th>			  </tr>			  <tr>			 				<th scope="row"><div align="left" class="style31"><%=gr(ct)%></div></th>			  </tr>			  <tr>				<th scope="row"><div align="left"><span class="style13 style21">				  <%		  strdata=formatData(FormatDateTime(dt,2))							  data = "SELECT * FROM 4AGENDA WHERE cod_politico="& session("cod_user") &" AND dtcompromisso='"& strdata &"'"		  Set RS_data = Server.CreateObject("ADODB.Recordset")		  SET RS_data = Conexao.Execute(data) 		  		  If RS_data.EOF = true then		  response.write "Nenhum compromisso"		  end if		  %>				  <%		  while Not RS_data.EOF		  %>				</span>					<table width="100%" border="0" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC">					  <tr style="cursor:default" onMouseOver="java script:this.style.backgroundColor='#00b3fe'" onMouseOut="java script:this.style.backgroundColor=''">						<th width="16%" scope="row"><div align="left" class="style27"><%= RS_data("horario") %></div></th>						<td width="84%"><div align="left" class="style26"><a class='tooltip' href='#'><%= Left(RS_data("chamada"),21) %>...<span>							<%				response.write "<font size=3><b>"& Ucase(RS_data("chamada")) & "</b></font><br><br>"				response.write RS_data("descricao") & "<br><br>"				if RS_data("publico")="s" then				response.write "<font color=#0099ff><b>TIPO: Público</b></font>"				else				response.write "<font color=#0099ff><b>TIPO: Não Público</b></font>"				end if				%>						</span></a></div></td>					  </tr>					</table>					<%RS_data.MoveNextwend RS_data.CloseSet RS_data = Nothing%></div></th>			  </tr>			</table></td>		  <%ct = ct + 1%>		  <%next%>		</tr>		<%next%>	</table>
ME AJUDA AI.. QDO TIVER PRONTO MANDO O CODIGO.

 

ABRAÇOS.

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.