Ir para conteúdo

POWERED BY:

Arquivado

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

pimenta

erro

Recommended Posts

Ola pessoal

 

Eu fiz esse código mas ta dando erro

 

ASP

[*]  <%

 

[*] '-------------------------------------------------- 

 

[*] ' FUNÇÃO BLOG BANCO DE DADOS 

 

[*] '-------------------------------------------------- 

 

[*]  Dim ConnDB

 

[*]  Set ConnDB = Server.CreateObject("ADODB.Connection")

 

[*]  ConnDB.Open "DBQ=" & Server.MapPath("../banco/principal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"

 

[*]  Set rs Server.CreateObject("ADODB.Recordset"%>

 

[*]

 

[*] <% 

 

[*]

 

[*] Conn.Open DataSource

 

[*] Set RS Server.CreateObject"ADODB.Recordset" ) 

 

[*]

 

[*] strSql "SELECT count (idnot) AS Total FROM artigos"

 

[*] set totalartigos Conn.execute(strSql) %>

 

[*]

 

[*]  <% 

 

[*]  '-------------------------------------------------- 

 

[*] ' FUNÇÃO POSTAGEM ARTIGO 

 

[*] '-------------------------------------------------- 

 

[*] RS.ActiveConnection = conn

 

[*] RS.open "SELECT TOP 10 titulo, autor, data,idnot FROM artigos order by idnot desc" %>

 

[*]  <% if not rs.eof then

 

[*]  contador = 0

 

[*]  while not rs.eof

 

[*] contador = contador +1

 

[*]  if len(contador) = 1 then

 

[*] contador "0" & contador

 

[*] end if 

 

[*] data2 rs("data")

 

[*] data split(data2,"/")

 

[*] dia data(0)

 

[*] mes data(1)

 

[*] ano data(2)

 

[*] if len(dia) = 1 then

 

[*] dia "0" & dia

 

[*] end if

 

[*] if len(mes) = 1 then

 

[*] mes "0" & mes

 

[*] end if

 

[*] if len(ano) = 1 then

 

[*] mes "0" & ano

 

[*] end if

 

[*] if data2 DATE() THEN

 

[*] data "<font color='#FF0000'>" & dia & "." & mes & "." & Right(ano, 2) & "</font>"

 

[*] else

 

[*] data = dia & "." & mes & "." & Right(ano, 2)

 

[*] end if %>

 

ERRO

Tipo de erro:Erro de compilação do Microsoft VBScript (0x800A0411)Redefinição do nome/blog/Jus eundi/blog/pcp_blog1.asp, line 5, column 4Dim ConnDB---^

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eu fiz algumas modificações

 

ASP

[*] <% 

 

[*] '-------------------------------------------------- 

 

[*] ' FUNÇÃO ARTIGO BANCO DE DADOS 

 

[*] '-------------------------------------------------- 

 

[*]  Dim ConnDB

 

[*]  Set ConnDB = Server.CreateObject("ADODB.Connection")

 

[*]  ConnDB.Open "DBQ=" & Server.MapPath("../banco/principal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"

 

[*]  Set rs Server.CreateObject("ADODB.Recordset")

 

[*]

 

[*] strSql "SELECT count (idnot) AS Total FROM artigos"

 

[*] set totalartigos ConnDB.execute(strSql) %>

 

[*]

 

[*]  <% 

 

[*]  '-------------------------------------------------- 

 

[*] ' FUNÇÃO POSTAGEM ARTIGO 

 

[*] '-------------------------------------------------- 

 

[*] RS.ActiveConnection = connDB

 

[*] SQL "SELECT TOP 10 titulo, autor, data,idnot FROM artigos order by idnot desc" 

 

[*] Set RS ConnDB.Execute(SQL)

 

[*]  if not rs.eof then

 

[*]  contador = 0

 

[*]  while not rs.eof

 

[*] contador = contador +1

 

[*]  if len(contador) = 1 then

 

[*] contador "0" & contador

 

[*] end if 

 

[*] data2 rs("data")

 

[*] datartigo split(data2,"/")

 

[*] dia datartigo(0)

 

[*] mes datartigo(1)

 

[*] ano datartigo(2)

 

[*] if len(dia) = 1 then

 

[*] dia "0" & dia

 

[*] end if

 

[*] if len(mes) = 1 then

 

[*] mes "0" & mes

 

[*] end if

 

[*] if len(ano) = 1 then

 

[*] mes "0" & ano

 

[*] end if

 

[*] if data2 DATE() THEN

 

[*] datartigo "<font color='#FF0000'>" & dia & "." & mes & "." & Right(ano, 2) & "</font>"

 

[*] else

 

[*] datartigo = dia & "." & mes & "." & Right(ano, 2)

 

[*] end if %>

 

E agora ta dando esse erro

Tipo de erro:Microsoft OLE DB Provider for ODBC Drivers (0x80040E37)[Microsoft][Driver ODBC para Microsoft Access] O mecanismo de banco de dados Microsoft Jet não encontrou a tabela de entrada ou consulta 'artigos'. Certifique-se de que ela existe e de que seu nome está digitado corretamente./blog/Jus eundi/artigo/pcp_artigo1.asp, line 11

Compartilhar este post


Link para o post
Compartilhar em outros sites

De uma olhada se o link do banco esta correto e se existe mesmo uma tabela com esse nome "artigos" na base de dados.T+

Compartilhar este post


Link para o post
Compartilhar em outros sites

Na verdade não existe erro algum...

O artigo funciona assim...

 <% 	'-------------------------------------------------- 	' FUNÇÃO ARTIGO BANCO DE DADOS 	'--------------------------------------------------     cnpath="DBQ=" & Server.MapPath("../banco/banco.mdb")     DataSource = "Driver={Microsoft Access Driver (*.mdb)}; " & cnpath     Set Conn = Server.CreateObject("ADODB.Connection")        Conn.Open DataSource    Set RS = Server.CreateObject( "ADODB.Recordset" ) 		strSql = "SELECT count (idnot) AS Total FROM artigos"    set totalartigos = Conn.execute(strSql) %>[QUOTE]
O blog assim

 <%	'-------------------------------------------------- 	' FUNÇÃO BLOG BANCO DE DADOS 	'--------------------------------------------------      Dim ConnDB     Set ConnDB =  Server.CreateObject("ADODB.Connection")     ConnDB.Open "DBQ=" & Server.MapPath("../banco/principal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}"     Set rs = Server.CreateObject("ADODB.Recordset")     strSql = "SELECT count (id) AS Total FROM posts"     set totalposts = ConnDB.execute(strSql)       SQL2 = "Select titblog From login"     Set RS = ConnDB.Execute(SQL2)     Session.LCID = 1046 'BRASIL %>

Eu estou tentando fazer um que faça funcionar os dois em vez de ter os 2 ai... entendeu?

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.