Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal, boa tarde.
Gostaria de uma ajuda dos programadores de plantão.
Talvez meu problema seja simples de resolver mas por enquanto minha capacidade técnica em se tratando de asp é pouca.
Vamos lá. Tenho um slideshow ótimo. Sempre uso em meus projetos.
Mas desta vez necessito trazer as informações de uma tabela no bd.
Está ai minha dúvida como trazer essas informações e preencher o array com elas.
Agradeço imensamente quem puder me ajudar.
segue o código já com o recordset que utilizo.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conexao.asp" -->
<%
Dim atletas
Dim atletas_cmd
Dim atletas_numRows
Set atletas_cmd = Server.CreateObject ("ADODB.Command")
atletas_cmd.ActiveConnection = MM_bdados_STRING
atletas_cmd.CommandText = "SELECT id, apelido, posicao, imagem FROM atletas"
atletas_cmd.Prepared = true
Set atletas = atletas_cmd.Execute
atletas_numRows = 0
%>
<html>
<head>
<style>
.Caption {
font-family: Arial;
font-weight: bold;
color: #123456;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
<script>
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;
// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;
var Picture = new Array();
var Caption = new Array();
var Position = new Array();
// Specify the image files...
Picture[1] = 'atletas/marcelo.gif';
Picture[2] = 'atletas/robson.gif';
// Specify the Captions...
Caption[1] = "Marcelo";
Caption[2] = "Robson";
Position[1] = "Goleiro";
Position[2] = "Zagueiro";
var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
if (document.getElementById) document.getElementById("PositionBox").innerHTML= Position[jss];
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body onload=runSlideShow()>
<table border=0 align="center" cellpadding=0 cellspacing=0>
<tr>
<td width=150 height=152>
<img src=atletas/fundo.gif name=PictureBox width=150 height=152> </td>
</tr>
<tr>
<td id=CaptionBox class=Caption align=center bgcolor=#fedcba>. </td>
</tr>
<tr>
<td id=PositionBox class=Caption align=center bgcolor=#fedcba> </td>
</tr>
</table>
</body>
</html>
<%
atletas.Close()
Set atletas = Nothing
%>Obrigado meu amigo por tentar ajudar...
Mas esse ainda não é solução para meu problema.
Oq necessito realmente é implementar ao meu script
um array preenchido com os dados do bd.
Está ai minha dúvida como carregar o array do meu código
com dados vindos do bd.
Fico no aguardo. E agradeço muito pela colaboração.
<%
"A conexão é feita normalmente
Set DBConnection = Server.CreateObject("adodb.connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.Mappath("pasta/database.mdb")
DSN = DSN & ";PWD=senha"
DBConnection.Open DSN
Response.Write "Base de Dados aberta <br>"
"Criara uma Query
SQL = "Select * From Customers Where Country = "Mexico""
"Pega o Record Set
Set RS = DBConnection.Execute(SQL)
Select Case RS.eof
Case False
RSArray = RS.getrows
"RSArray(Field, Record)
Numero_de_Campos = Cdbl(UBound(RSArray, 1))
Numero_de_Registros = Cdbl(UBound(RSArray, 2))%>
<table border="1" width="300">
<%For R = 0 to Numero_de_Registros
Response.Write "<tr>"
For F = 0 to Numero_de_Campos
Response.Write "<td> " & RSArray(F, R) & "</td> "
Next
Response.Write "</tr>"
Next
Response.Write "</table>"
Case True
Response.Write "Não há registros!"
End Select
"Agora destruiremos o recordset (RS)
Set RS = Nothing
Response.Write "<br>Base de dados fechada <br>"
%>
existem exemplos de galeria no lab. de script, pode te ajudar
olha este exemplo: