/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
problem with output from database to file
Fra : Stian Skjævesland


Dato : 13-06-01 11:31

Hi there!
Due to heavy traffic on my db-connected asp-page I want to cache it.
This is done by collecting all the data to the asp-page and then writing the
finished html-code to a html-file using textstream.

I get "the page cannot be displayed" on this one... I guess there's
something wrong with my code...

PS: Is there a good program that can debug such pages? I would like to
know..

-------THE CODE------------------
<%
'Åpner databasen
Set Con = Server.CreateObject("ADODB.Connection")
ConString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("\live\mklive.mdb") & ";"
Con.Open(ConString)

'Deklarerer variablene til tekstfila
Dim topp
Dim hendelse
Dim credit

topp = "<html><head><title>MK live</title></head><body bgcolor='#FFFFFF'
link='#0000FF' vlink='#0000FF' alink='#0000FF'>" &_
"<br><table width='610' border='0' cellspacing='0' cellpadding='0'>" &_
"<tr><td width='10'> </td><td width='600'>" &_
"<table width='600' border='0' cellspacing='2' cellpadding='2'>" &_
"<tr><td colspan='4'><hr noshade size='1' color='#008100'>" &_
"<table width='100%' border='0' cellspacing='3' cellpadding='3'>" &_
"<tr><td><img src='images/sandefjord.gif' width='61' height='67'></td>" &_
"<td><div align='center'><font face='Geneva, Arial, Helvetica, san-serif'
size='4'>" &_
"<b>Sandefjord - Mandalskameratene<br><font size='2'>Søndag 27. mai kl.
18.00</font></b></font>" &_
"</div></td><td><div align='right'><img src='images/logo.gif' width='60'
height='60'></div>" &_
"</td></tr></table><font face='Geneva, Arial, Helvetica, san-serif'
size='4'></font><hr noshade size='1' color='#008100'>" &_
"<div align='center'><font face='Arial, Helvetica, sans-serif' size='1'><a
href='live.asp'>" &_
"<img src='oppdater.gif' width='75' height='16' border='0'></a><br>" &_
"TRYKK "OPPDATER" FOR Å FÅ MED DEG SISTE OPPDATERING FRA
KAMPEN.</font><br>" &_
"</div><hr noshade size='1' color='#008100'></td></tr>"



credit= "<tr valign='top'><td colspan='4'><hr size='1' noshade
color='#008100'></td></tr><tr valign='top'>" &_
"<td colspan='4'><div align='center'><font face='Arial, Helvetica,
sans-serif' size='1' color='#999999'>" &_
"live scoring powered by Nettmat
OnWeb</font></div></td></tr></table></td></tr></table><br></body></html>"

SQLLIVE = "SELECT * FROM live ORDER BY live_id DESC "
set innlegg = Con.Execute(SQLLIVE)

Dim fso, objTextStream
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Const TristateFalse = 0
'--Write to file
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set objTextStream = fso.OpenTextFile( Server.MapPath("\live\score.htm"),
ForAppending, True, TristateFalse)
objTextStream.WriteLine topp
DO WHILE NOT innlegg.EOF
hendelse = "<tr valign='top'><td width='25'><b><img src='images/" &_
innlegg(1) &_
".gif' width='22' height='22'></b></td><td width='50'><div align='right'>"
&_
"<font face='Geneva, Arial, Helvetica, san-serif' size='2'><b>" &_
innlegg(2) &_
"</b></font></div></td><td width='1'></td><td width='520'><font
face='Geneva, Arial, Helvetica, san-serif' size='2'>" &_
innlegg(3) &_
"</font></td></tr>"
objTextStream.WriteLine hendelse
innlegg.MOVENEXT
LOOP
objTextStream.WriteLine credit
objTextStream.Close
Set objTextStream = Nothing
Set fso = Nothing

Con.Close
Set Con = Nothing
%>
<html><head><title>Test</title></head><body>OK!</body></html>

--------END OF CODE--------



 
 
Aaron Bertrand (13-06-2001)
Kommentar
Fra : Aaron Bertrand


Dato : 13-06-01 15:08

http://www.aspfaq.com/faq/faqShow.asp?fid=84

http://www.aspfaq.com/faq/faqShow.asp?fid=196





"Stian Skjævesland" <sstian@online.no> wrote in message
news:JfHV6.441$_96.19675@news3.oke.nextra.no...
> Hi there!
> Due to heavy traffic on my db-connected asp-page I want to cache it.
> This is done by collecting all the data to the asp-page and then writing
the
> finished html-code to a html-file using textstream.
>
> I get "the page cannot be displayed" on this one... I guess there's
> something wrong with my code...
>
> PS: Is there a good program that can debug such pages? I would like to
> know..
>
> -------THE CODE------------------
> <%
> 'Åpner databasen
> Set Con = Server.CreateObject("ADODB.Connection")
> ConString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
> "DBQ=" & Server.MapPath("\live\mklive.mdb") & ";"
> Con.Open(ConString)
>
> 'Deklarerer variablene til tekstfila
> Dim topp
> Dim hendelse
> Dim credit
>
> topp = "<html><head><title>MK live</title></head><body bgcolor='#FFFFFF'
> link='#0000FF' vlink='#0000FF' alink='#0000FF'>" &_
> "<br><table width='610' border='0' cellspacing='0' cellpadding='0'>" &_
> "<tr><td width='10'> </td><td width='600'>" &_
> "<table width='600' border='0' cellspacing='2' cellpadding='2'>" &_
> "<tr><td colspan='4'><hr noshade size='1' color='#008100'>" &_
> "<table width='100%' border='0' cellspacing='3' cellpadding='3'>" &_
> "<tr><td><img src='images/sandefjord.gif' width='61' height='67'></td>"
&_
> "<td><div align='center'><font face='Geneva, Arial, Helvetica, san-serif'
> size='4'>" &_
> "<b>Sandefjord - Mandalskameratene<br><font size='2'>Søndag 27. mai kl.
> 18.00</font></b></font>" &_
> "</div></td><td><div align='right'><img src='images/logo.gif' width='60'
> height='60'></div>" &_
> "</td></tr></table><font face='Geneva, Arial, Helvetica, san-serif'
> size='4'></font><hr noshade size='1' color='#008100'>" &_
> "<div align='center'><font face='Arial, Helvetica, sans-serif'
size='1'><a
> href='live.asp'>" &_
> "<img src='oppdater.gif' width='75' height='16' border='0'></a><br>" &_
> "TRYKK "OPPDATER" FOR Å FÅ MED DEG SISTE OPPDATERING FRA
> KAMPEN.</font><br>" &_
> "</div><hr noshade size='1' color='#008100'></td></tr>"
>
>
>
> credit= "<tr valign='top'><td colspan='4'><hr size='1' noshade
> color='#008100'></td></tr><tr valign='top'>" &_
> "<td colspan='4'><div align='center'><font face='Arial, Helvetica,
> sans-serif' size='1' color='#999999'>" &_
> "live scoring powered by Nettmat
> OnWeb</font></div></td></tr></table></td></tr></table><br></body></html>"
>
> SQLLIVE = "SELECT * FROM live ORDER BY live_id DESC "
> set innlegg = Con.Execute(SQLLIVE)
>
> Dim fso, objTextStream
> Const ForReading = 1
> Const ForWriting = 2
> Const ForAppending = 8
> Const TristateFalse = 0
> '--Write to file
> Set fso = Server.CreateObject("Scripting.FileSystemObject")
> Set objTextStream = fso.OpenTextFile(
Server.MapPath("\live\score.htm"),
> ForAppending, True, TristateFalse)
> objTextStream.WriteLine topp
> DO WHILE NOT innlegg.EOF
> hendelse = "<tr valign='top'><td width='25'><b><img src='images/" &_
> innlegg(1) &_
> ".gif' width='22' height='22'></b></td><td width='50'><div
align='right'>"
> &_
> "<font face='Geneva, Arial, Helvetica, san-serif' size='2'><b>" &_
> innlegg(2) &_
> "</b></font></div></td><td width='1'></td><td width='520'><font
> face='Geneva, Arial, Helvetica, san-serif' size='2'>" &_
> innlegg(3) &_
> "</font></td></tr>"
> objTextStream.WriteLine hendelse
> innlegg.MOVENEXT
> LOOP
> objTextStream.WriteLine credit
> objTextStream.Close
> Set objTextStream = Nothing
> Set fso = Nothing
>
> Con.Close
> Set Con = Nothing
> %>
> <html><head><title>Test</title></head><body>OK!</body></html>
>
> --------END OF CODE--------
>
>



Søg
Reklame
Statistik
Spørgsmål : 177508
Tips : 31968
Nyheder : 719565
Indlæg : 6408580
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste