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

Probleminha De Conexão


maktub

Pergunta

Fala pessoal, to com um probleminha de conexão com o BD, podem me ajudar, segue abaixo a parte do código bem como o erro:

conecta.asp

<%
local=Request.ServerVariables("SERVER_NAME")

if local="www.alfastation.com.br" or local="alfastation.com.br" then
conexao = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\testes\enquete2\bd.mdb;Persist Security Info=False"
endereco_virtual="http://"&local&"/victor"
endereco_fisico="D:\inetpub\clientes\alfastation.com.br\victor"
end if

if local="victor-vick" or local="localhost" or local="alfa" then
conexao= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\testes\enquete2\bd.mdb;Persist Security Info=False"
endereco_virtual="http://"&local&"/testes/enquete2"
endereco_fisico="C:\Inetpub\wwwroot\testes\enquete2\bd.mdb"
end if

set conn = Server.CreateObject("adodb.connection")
conn.open conexao
%>
esse é o erro:
Microsoft OLE DB Provider for ODBC Drivers error '80004005' 

[Microsoft][ODBC Driver Manager] Nome da fonte de dados não encontrado e nenhum driver padrão especificado 

/testes/enquete2/conecta.asp, line 17 
e este é o código da enquete: enquete.asp
<!-- #include file="conecta.asp"-->
<!-- #include file="estilo_enquete.css"-->
<head>
	<title>ENQUETE</title>
</head>
<script language=javascript>
function submit_enquete(){
	w = 0;
	for (x = 0; x <= form_enquete.ta.value; x++){
  if (w < form_enquete.alternativa[x].value.length){
  	w=form_enquete.alternativa[x].value.length;
  }
  if(form_enquete.alternativa[x].checked==true){
  	alter = form_enquete.alternativa[x].value
  }
	}
	window.open("enquete.asp?alternativa="+alter+"","Enquete","left=10,top=10,width="+((w*7)+200)+",height=280,scrollbars=no");
}
</script>

<%Set RecSet = Server.CreateObject("adodb.recordset")%>
<%if Request.querystring("alternativa") <> "" then%>

<%
if Request.QueryString("alternativa") <> "resultado" then
	if session("votacao") <> "votado" then
  Conn.Execute "Update alternativa set votos = (votos+1) where alternativa = '"&Request.QueryString("alternativa")&"'"
  session("votacao") = "votado"
  mensagem = "<font color=336699>Obrigado pelo seu voto.</font>"
	else
  mensagem = "<font color=red>Seu voto já foi registrado.</font>"
	end if
end if
%>
<table border=1 bordercolor=ffffff cellpadding=0 cellspacing=0 style="border-collapse: collapse" width=100%>
<%
RecSet.Open "Select * from pergunta order by id desc", conn, 3
	if RecSet.EOF then Response.End
	id_pergunta = RecSet("id")
	%>
	<tr>
  <td class=geral colspan=3 height=25 valign=top bordercolor=ffffff><center><b><%=RecSet("pergunta")%></b></center><br></td>
	</tr>
	<%
RecSet.Close


RecSet.Open "Select alternativa, votos from alternativa where id_pergunta = "&id_pergunta&"", conn
	if not RecSet.EOF then
  while not RecSet.EOF
  	tv=tv+RecSet("votos")
  	RecSet.MoveNext
  wend
	end if
RecSet.Close

RecSet.Open "Select alternativa, votos from alternativa where id_pergunta = "&id_pergunta&"", conn
	if not RecSet.EOF then
  while not RecSet.EOF
  	%>
  	<tr bordercolor="#FFFFFF">
    <td class=geral><%=RecSet("alternativa")%></td>
    <td bgcolor=#777777 width=100><img src="imagens/cilindro_vermelho.gif" height=15 width="<%=RecSet("votos")*100/tv%>"></td>
    <td class=geral><%=formatnumber((RecSet("votos")*100)/tv, 2)%> %</td>
  	</tr>
  	<%
  	RecSet.MoveNext
  wend
	end if
RecSet.Close

if session("votacao") = "votado" then
	%>
	<tr>
  <td colspan=3 class=geral>
  	<center>
  	<br><font color="#000080"><b>Total de votos: <%=tv%></b></font><br>
  	<br><%=mensagem%>
  	</center>
  </td>
	</tr>
	<%
end if
%>
</table>



<%else%>

<form action=enquete.asp method=post id=form_enquete>
<table border=3 bordercolor=#444444>
<%
RecSet.Open "Select * from pergunta order by id desc", conn
	if RecSet.EOF then Response.End
	id_pergunta = RecSet("id")
	%>
	<tr bordercolor="#FFFFFF">
  <td class=geral><b><%=RecSet("pergunta")%></b></td>
	</tr>
	<%
RecSet.Close



RecSet.Open "Select id, alternativa from alternativa where id_pergunta = "&id_pergunta&"", conn, 3
	if not RecSet.EOF then
  tr = RecSet.RecordCount
  w = 0
  while not RecSet.EOF
  	if w < len(RecSet("alternativa")) then
    w = len(RecSet("alternativa"))
  	end if
  	%>
  	<tr bordercolor="#FFFFFF">
    <td class=geral width=150><input type=radio id=alternativa name=alternativa value="<%=RecSet("alternativa")%>"> <%=RecSet("alternativa")%></td>
  	</tr>  	
  	<%
  	RecSet.MoveNext
  wend
	end if
RecSet.Close
%>
<tr bordercolor="#FFFFFF">
	<td>
  <input type=hidden name=ta value=<%=tr-1%>>
  <a href=enquete.asp?acao=votar class=link_enquete onclick=submit_enquete();> <img src=imagens/setinha.gif border=0> Votar</a><br>
  <a href=enquete.asp?acao=resultado class=link_enquete onclick="window.open('enquete.asp?alternativa=resultado','Enquete','left=10,top=10,width=<%=(w*7)+200%>,height=280,scrollbars=no');"> <img src=imagens/setinha.gif border=0> Resultado</a>
	</td>
</tr>
</table>
</form>
<%end if%>
<%Set RecSet = nothing%>

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

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