Author |
Topic  |
|
Freeman II
Junior Member
 
232 Posts |
Posted - 30 July 2001 : 14:44:20
|
i wanna make a table using ASP, and the asp file reads a txt file to get the data. just like using a DB. my question is how to use commas to seperate columns and line breaks to seperate rows. can someone give me an example?
this is what i got so far but it reads only 1st line.
<% myfile = "asd.txt" %> <% DIM myfso, myStream
Set myfso = CreateObject("Scripting.FilesystemObject") If myfso.FileExists(Server.MapPath(myFile)) then Set myStream = myfso.OpenTextFile(Server.MapPath(myFile), "1", "0") i=1 Do While (Not myStream.AtEndOfStream) and (i < myLine) myStream.SkipLine() i = i+1 loop if myStream.AtEndOfStream then myMsg = "" else myMsg = myStream.ReadLine myline = i end if myStream.Close set myStream = nothing set myfso = nothing else myMsg = "" end if%>
<tr> <td width="20%" align="center"><% =myMsg %></td> <td width="20%" align="center"> </td> <td width="20%" align="center"> </td> <td width="20%" align="center"> </td> <td width="20%" align="center"> </td> </tr>
only the first cell is displayed.
this is what i have in asd.txt 12sda2sdfdsasdf 31:49 PM 30/07/20011:49 PM 30/07/2001 asdf
|
|
Spoon
Average Member
  
Ireland
507 Posts |
Posted - 30 July 2001 : 17:18:43
|
hehe, what?
Use a database of you can. I've read articles on reading from txt files, but its incredibly messy and not very versatile
Regards - Spoon
Begineer? Need help installing the forums? - www.aslickpage.com/snitz_help.html
www.ASlickPage.com - Private Messaging |
 |
|
Id
Junior Member
 
USA
129 Posts |
Posted - 30 July 2001 : 17:42:12
|
you could use the split function, i.e. ArrayVar = Split(strName, ",") then it divides the string into sections that are broken apart by a comma and then puts them into an array. The only problem with this is the split function can only break up by what's inbetween the "" (you could do Split(strName, ": ;") and it would work fine but not Split(strName, " ", ",")
That might work for you
Going insane one day at a time |
 |
|
Freeman II
Junior Member
 
232 Posts |
Posted - 31 July 2001 : 17:45:32
|
i have a problem, it only reads the first line. how do you code a loop so the server reads every line of the text file?
|
 |
|
Kat
Advanced Member
    
United Kingdom
3065 Posts |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 03 August 2001 : 06:32:47
|
you could also check out the admin_mod_dbsetup.asp which comes with v33, it parses a text file to create the DB update scripts.
|
 |
|
|
Topic  |
|