Galera, alguém poderia dar uma ajuda neste código:
Ele tem que fazer uma paginação em um arquivo txt.
<%
Const forReading=1, forWriting=2, forAppending=8
Dim objteste, objtextstream, fso, objfile, objStream, x
Set fso = CreateObject("Scripting.FileSystemObject")
set objfile = fso.GetFile ("F:\2006.txt")
set objStream = objfile.OpenAsTextStream(forReading,false)
Texto = ObjStream.ReadAll
for x=0 to UBound(Texto)
cont = cont+1
arrImage(pag,cont) = Texto
if cont = 10 then
pag = pag+1
cont = 0
end if
next
Set Objfso = nothing
SetObjArq = nothing
MaxRecords = 10
MaxPages = Round (Texto/MaxRecords)
if request("pagi") = "" then
pagi=1
else
pagi=request("pagi")
end if
for j=1 to 10
response.write dados(x)
counter=1
Do while counter<=MaxPages
isStart = (((counter-1)*MaxRecords)+1)
if cint(counter) = cint(pagi) then
ref = ref & "Anterior |"
else
ref = ref &"<a href = teste16.asp?pagi="&counter&">Próxima</a>"
if counter < MaxPages then
ref = ref &"|"
end if
end if
counter = counter+1
loop
response.write ref
next
%>
![Photo](http://www.gravatar.com/avatar/537e3f3048026d9f5f5cee43c1459312?s=100&d=http%3A%2F%2Fforum.wmonline.com.br%2Fpublic%2Fstyle_images%2Fmaster%2Fprofile%2Fdefault_large.png)
Paginação Asp X Txt
Started By thicomp, 20/12/2006, 07:12
6 replies to this topic
#1
Posted 20/12/2006, 07:12
#2
Posted 20/12/2006, 07:51
Ele tem que fazer mas não está fazendo?
Qual o problema apresentado?
Explique melhor sua duvida.
[]s
Qual o problema apresentado?
Explique melhor sua duvida.
[]s
#3
Posted 20/12/2006, 07:59
É isso aí, não sei se a lógica tá mt correta
O erro está ocorrendo no "for"
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'UBound'
/Cristalia/teste16.asp, line 8
O erro está ocorrendo no "for"
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'UBound'
/Cristalia/teste16.asp, line 8
#4
Posted 20/12/2006, 09:38
A variavel Texto não é um Array.
Como está o conteudo do txt?
Talvez você tenha que fazer um split no conteudo para criar uma array e ai sim usar o For.
[]s
Como está o conteudo do txt?
Talvez você tenha que fazer um split no conteudo para criar uma array e ai sim usar o For.
[]s
#5
Posted 20/12/2006, 09:52
Ah cara, blz...
Tem esta linha de código tb...
Texto = ObjStream.ReadAll
Dados = Split(Replace(Texto, Chr(59),""),Chr(10))
for x=0 to UBound(Texto)
O arquivo txt está separado por ponto e vírgula ( ; ) e por quebra de linha
Tem esta linha de código tb...
Texto = ObjStream.ReadAll
Dados = Split(Replace(Texto, Chr(59),""),Chr(10))
for x=0 to UBound(Texto)
O arquivo txt está separado por ponto e vírgula ( ; ) e por quebra de linha
#6
Posted 20/12/2006, 10:13
Tenta mudar então
por
[]s
for x=0 to UBound(Texto)
por
for x=0 to UBound(Dados)
[]s
#7
Posted 20/12/2006, 10:20
Meu código está assim
<%
Const forReading=1, forWriting=2, forAppending=8
Dim objteste, objtextstream, FSO, objfile, objStream, x
Set FSO = CreateObject("Scripting.FileSystemObject")
set objfile = FSO.GetFile ("F:\nextgeneration\Root\Cristalia\2006.txt")
set objStream = objfile.OpenAsTextStream(forReading,false)
set FSO = nothing
Texto = ObjStream.ReadAll
Dados = Split(Replace(Texto, Chr(59),""),Chr(10))
for x=0 to UBound(Dados)
cont = cont+1
arrImage(pag,cont) = Dados
if cont = 10 then
pag = pag+1
cont = 0
end if
next
Set Objfso = nothing
Set ObjArq = nothing
MaxRecords = 10
MaxPages = Round (Dados/MaxRecords)
if request("pagi") = "" then
pagi=1
else
pagi=request("pagi")
end if
for j=1 to 10
response.write dados(x)
counter=1
Do while counter<=MaxPages
isStart = (((counter-1)*MaxRecords)+1)
if cint(counter) = cint(pagi) then
ref = ref & "Anterior |"
else
ref = ref &"<a href = teste16.asp?pagi="&counter&">Próxima</a>"
if counter < MaxPages then
ref = ref &"|"
end if
end if
counter = counter+1
loop
response.write ref
next
%>
Me retorna este erro (a linha 12 é a linha em vermelho)
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'arrImage'
/teste16.asp, line 12
<%
Const forReading=1, forWriting=2, forAppending=8
Dim objteste, objtextstream, FSO, objfile, objStream, x
Set FSO = CreateObject("Scripting.FileSystemObject")
set objfile = FSO.GetFile ("F:\nextgeneration\Root\Cristalia\2006.txt")
set objStream = objfile.OpenAsTextStream(forReading,false)
set FSO = nothing
Texto = ObjStream.ReadAll
Dados = Split(Replace(Texto, Chr(59),""),Chr(10))
for x=0 to UBound(Dados)
cont = cont+1
arrImage(pag,cont) = Dados
if cont = 10 then
pag = pag+1
cont = 0
end if
next
Set Objfso = nothing
Set ObjArq = nothing
MaxRecords = 10
MaxPages = Round (Dados/MaxRecords)
if request("pagi") = "" then
pagi=1
else
pagi=request("pagi")
end if
for j=1 to 10
response.write dados(x)
counter=1
Do while counter<=MaxPages
isStart = (((counter-1)*MaxRecords)+1)
if cint(counter) = cint(pagi) then
ref = ref & "Anterior |"
else
ref = ref &"<a href = teste16.asp?pagi="&counter&">Próxima</a>"
if counter < MaxPages then
ref = ref &"|"
end if
end if
counter = counter+1
loop
response.write ref
next
%>
Me retorna este erro (a linha 12 é a linha em vermelho)
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'arrImage'
/teste16.asp, line 12
Edição feita por: thicomp, 26/12/2006, 08:03.
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)