Subject: How to generate report from txt file by asp
Posted By: kiwibey Post Date: 11/18/2004 10:36:25 PM
hi everybody,
i'm a beginer in using asp.
now i have a project need me generate the report from txt file..
i have no idea about...
anybody can help me ??
thank you ...

bey

Reply By: om_prakash Reply Date: 11/18/2004 11:24:55 PM
What is the data format? You can use can use filesystemobject to read and display data.

Om Prakash
Reply By: kiwibey Reply Date: 11/19/2004 4:06:49 AM
hi Om Prakash,
the data format is as below:
"FileName","NoOfPages","Date(YMD)","user"
it will retieve the file in text file format (.txt)
have any example for "filesystemobject"
thank you very much.......

bey


Reply By: om_prakash Reply Date: 11/20/2004 3:55:16 AM
Hi,

 Please check the following code:

<%
Option Explicit
'Code to display data from the current text-based logfile
Dim objFSO, oInStream, sLine, sSeg

'Define the constants used by the FSO
Const Forreading = 1

'Create an instance of the FSO
Set objFSO = CreateObject("Scripting.fileSystemObject")

'Check the file exists
If objFSO.fileExists( Server.MapPath( "stuff.txt" ) ) Then

'Open a file for reading
Set oInStream = objFSO.OpenTextfile( Server.MapPath( "stuff.txt" ), Forreading, False )

Do Until oInStream.AtEndOfStream

sLine = oInStream.ReadLine
sSeg = Split( sLine, "," )

Response.Write "<b>A</b>: " & sSeg(0)
Response.Write "<b>B</b>: " & sSeg(1)
Response.Write "<b>C</b>: " & sSeg(2)

Response.Write "<br>"

Loop

oInStream.Close
Set oInStream = Nothing

Else

Response.Write "file not found!"

End If
Set objFSO = Nothing
%>


Om Prakash
Reply By: kiwibey Reply Date: 11/23/2004 11:01:56 PM
Hi Om Prakash,
your code is very useful for me...
thank you very much.......

bey


Go to topic 22445

Return to index page 707
Return to index page 706
Return to index page 705
Return to index page 704
Return to index page 703
Return to index page 702
Return to index page 701
Return to index page 700
Return to index page 699
Return to index page 698