Visualizzare immagine a seconda del valore del db

venerdì 27 giugno 2008 - 00.50

ertulio Profilo | Senior Member

Salve, ho la necessita di visualizzare un immagine a seconda del valore che cè nel database access. Ad esempio vorrei che se nel db il campo esito è "pos" mi visualizzi un immagine con uno +, se invece è neutro mi visualizzi un altra immagine.
Per visualizzare il testo utilizzo questo codice che me lo fa anche ruotare. Per effettuare la modifica che mi faccia vedere per un determinato campo la foto a seconda del valore come si fa?? come posso modificare?? Spero di essere stato chiaro. Grazie

<%


Dim sTxt, iSpeed, iTop, iLeft, iWidth, iHeight, sHtml1, sHtml2, sHtml4, strSQL,sMarquee
Dim conCurrent
Dim rstCurrent
Set conCurrent = CreateObject("ADODB.Connection")
Set rstCurrent = Server.CreateObject("ADODB.Recordset")
conCurrent.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/mdb-database/SMC.mdb")
strSQL = "SELECT * FROM News "
Set rstCurrent = conCurrent.Execute(strSQL)
sHtml1 = "<P><CENTER><FONT SIZE='-1' COLOR='Blue'>"
'sHtml2 = "<A HREF='newsdetail.asp?ID="
'sHtml3 = "'>"
sHtml4 = "</A></FONT></CENTER></P>"
sTxt = ""
rstCurrent.movefirst
do while not rstCurrent.eof 'I used variables here to try and reduce this long assignment
sTxt = sTxt & sHtml1 & rstCurrent("Data") & " - " & sHtml3 & rstCurrent("Esito") & sHtml4
rstCurrent.movenext
loop
iSpeed = 40 ' Speed of Marquee (higher = slower)
iTop = 0 ' Y Location Within Object
iLeft = 0 ' X Location""""
iWidth = 185 ' Width
iHeight = 100 ' Height
'Insert marquee into objects innerHtml Property (in this Case a table cell)
sMarquee="<MARQUEE onmouseover='this.stop();' " & _
"onmouseout='this.start();'direction='up' scrollamount='1' " & _
"scrolldelay='" & iSpeed & "' top='" & iTop & "' left='" & iLeft & _
"' width='" & iWidth & "' height='" & iHeight & "'>" & sTxt & "</MARQUEE>"

conCurrent.close 'Don't forget to clean-up!
set conCurrent = Nothing
%>
<%=sMarquee%>
http://www.risorsefantacalcio.it

Risorse per tutti gli appassionati di fantacalcio da cui prelevare news, probabili formazioni, voti del corriere e gazzetta e tanhto altro.

Wamba Profilo | Expert

ciao ertulio,
questo non è asp.net 1.0/1.1 è asp. Ti consiglio di convertire il codice, ammesso che tu possa farlo.
Potrei non aver capito il tuo problema: in questo stile per generare un immagine fai quello che hai fatto per il marquee: crei una stringa con dentro l'html, solo che stavolta il tag è img.


-----------------------------------------------------------
Solo chi ha il Caos dentro può generare una stella danzante
Wamba
http://blogs.ugidotnet.org/WamBlog/
http://www.intellimaker.com
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5