Ir para conteúdo
Fórum Script Brasil
  • 0

(Resolvido) Aniversariantes do dia com FOTO


FranChæs¿ng®

Pergunta

Olá, galera ASP !

Venho aqui pedir ajuda de vocês no intuido de descobrirem como fazer para o nosso glorioso ASP ler o registro de cada foto, pois nesse código lê apenas a foto referente ao primeiro registro da data do dia e repete a mesma foto em todos os outros registros. Observação: coloque a data do dia para poder aparecer a foto, na hora do teste, pois do contrário dá erro na página ! Ainda tem que ser feito o tratamento para quando não encontrar a foto.jpg referente à data do dia...

Segue abaixo o script e a estrutura do banco de dados Access 2000/XP é assim:

Nome do BD = ANIVER.MDB

Nome da TABELA = anivers1

ID = AUTONUMERACAO

NR_CGM = TEXT

DS_TURMA = TEXT

IDADE = TEXT

DT_NASC = TEXT

NM_ALUNO = TEXT

FOTO = TEXT

-------------

aniver.asp

-------------

<%response.buffer = true%>

<HTML><title>ANIVERSARIANTES DO DIA</title>

<style type="text/css">

<!--

body {

background-color: #FFFFFF;

}

-->

</style>

<link href="../mod.css" rel="stylesheet" type="text/css">

<meta name="generator" content="Namo WebEditor v5.0(Trial)">

<BODY topmargin=" 0" leftmargin="2">

<p> <img src="../aniver/top.gif" width="420" height="56" border="0">

<table width="418" border="0" cellpadding="0" cellspacing="0" bordercolor="#00CCFF" bgcolor="#EDFCF4" class="fontpeq">

<tr>

<td width="418">

<div align="center">

<p>

<font size="1"><font size="2"><%

mTitleColor = "DARKRED" '* This is the color of the title 'Today in History' *'

mHeaderColor = "DARKBLUE" '* This is the color of the headers, Birthdays, Events *'

mYearColor = "DARKGREEN" '* This is the color of the year *'

mTextColor = "BLACK" '* This is the color of the text of the birthday or event *'

mTitle = "Teresina, " '* What you want to appear as the title *'

mDataBaseDir = "c:\Inetpub\wwwroot\dados\ANIVER.mdb"

'* Function para retornar o mês 1-12 *'

function toLongMonth(pInInteger)

mMonth = "Not Found"

if isNumeric(pInInteger) then

select case pInInteger

case 1: mMonth = "Janeiro"

case 2: mMonth = "Fevereiro"

case 3: mMonth = "Março"

case 4: mMonth = "Abril"

case 5: mMonth = "Maio"

case 6: mMonth = "Junho"

case 7: mMonth = "Julho"

case 8: mMonth = "Agosto"

case 9: mMonth = "Setembro"

case 10: mMonth = "Outubto"

case 11: mMonth = "Novembro"

case 12: mMonth = "Dezembro"

end select

end if

toLongMonth = mMonth

end function

'* Open DSNless connection to Today.mdb *'

set connGlobal = server.createobject("ADODB.Connection")

connGlobal.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ= " & (mDataBaseDir)

'* SQL Statement to pull data *'

mSQL = "SELECT DT_NASC, NM_ALUNO, DS_TURMA, FOTO FROM anivers1" & _

" WHERE day(DT_NASC) = DAY(NOW) " & _

" AND MONTH(DT_NASC) = MONTH(NOW) " & _

" ORDER BY DT_NASC "

'* Execute the SQL statement *'

set rsGlobal = connGlobal.execute(mSQL)

set Dbrec = connGlobal.execute(mSQL )

foto1="/images/" & rsGlobal("foto")

'* Display The Title *'

response.write "<FONT face = 'Arial, Helvetica, sans-serif' COLOR = " & mTitleColor & " SIZE = '-1'><B>" & mTitle & _

datepart("d", date()) & _

" de " & toLongMonth(datepart("m", date()))& " de " & datepart("yyyy", date()) & _

"</b></FONT><BR><BR>"

'* Display The Birthday Tag *'

%>

</font></font><span class="fontetopicopequeCopy"><B>Aniversariantes

de hoje:</b> </span></p>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" class="formborda">

<tr bgcolor="#CFFCD1" class="fontetopicopequeCopy">

<td width="275" valign="middle"> <div align="center"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">NOME</font></b></div></td>

<td width="50" valign="middle"> <div align="center"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">TURMA</font></b></div></td>

<td width="51" valign="middle">

<div align="center"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">FOTO</font></b></div></td>

</tr>

<tr>

<%

mType = "B"

'* Initialize a table that will be used to format results of rsGlobal *'

response.write "<TABLE WIDTH = '100%'>"

'* Loop through recordset *'

while not rsGlobal.eof

%>

<td width="275">

<font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%response.write(rsGlobal("NM_ALUNO"))%></font></td>

<td width="50"> <div align="center">

<font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><%response.write (RSGLOBAL("DS_TURMA"))%></font></div></td>

<td width="51">

<p align="center"><a href="../<%=link1%>"><img src="..<%=foto1%>" border="0"></a></td>

</tr>

<%'* Move to the next record *'

rsGlobal.movenext

wend

'* Close the table *'

response.write "</TABLE>"

'* Close the recordset and connection *'

rsGlobal.close

set rsGlobal = nothing

connGlobal.close

set connGlobal = nothing

'* All Done *'

%>

</table>

<font face="Arial, Helvetica, sans-serif" size="2"><a href="../aniver/aniver_mes.asp"><font color="#FF6600" size="1">Veja

os aniversariante do mês</font></a></font></div>

</td>

</tr>

</table>

<font size="1"></font><font size="1"></font>

<div align="center"></div>

</body>

</html>

Muito obrigado à todos !!!

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Troque esse:

<img src="..<%=foto1%>" border="0">
Por esse:
<img src="images/<%=rsGlobal("FOTO")%>" border="0">

ou 2ª opção mesmo resultado da primeira... so muda o local do arquivo

Teste e poste o resultado !!!!!

Editado por bareta
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...