|
 |
asp_databases thread: Every other line from a text file
Message #1 by "chris hoayun" <choayun@h...> on Sat, 1 Feb 2003 17:41:11
|
|
I was wondering how to create a text box which only displays lines 2, 4,
6, 8, ect. from a text file.
Could anyone help?
Message #2 by Greg Griffiths <greg2@s...> on Sat, 01 Feb 2003 18:55:57 +0000
|
|
You will need to have some kind of counter, then you can test to see if the
line is one you wish to print or not.
At 17:41 01/02/03 +0000, you wrote:
>I was wondering how to create a text box which only displays lines 2, 4,
>6, 8, ect. from a text file.
>
>Could anyone help?
Message #3 by "Pat Wong" <vinyl-junkie@n...> on Sat, 1 Feb 2003 11:12:29 -0800
|
|
I'll add to this response, because I have something similar. What I'm doing though is making a
different background color on a table with every other record. Here's an abbreviated version of
what I did. Hope this helps.
Do While Not objPagingRS.EOF
do something here with the first (i.e., odd numbered record)
objPagingRS.MoveNext
If Not objPagingRS.EOF Then
do something here with the next (i.e., even numbered record)
End If
objPagingRS.MoveNext
Loop
----- Original Message -----
From: "Greg Griffiths" <greg2@s...>
To: "ASP Databases" <asp_databases@p...>
Sent: Saturday, February 01, 2003 10:55 AM
Subject: [asp_databases] Re: Every other line from a text file
| You will need to have some kind of counter, then you can test to see if the
| line is one you wish to print or not.
|
| At 17:41 01/02/03 +0000, you wrote:
| >I was wondering how to create a text box which only displays lines 2, 4,
| >6, 8, ect. from a text file.
| >
| >Could anyone help?
|
|
|
|
|
Message #4 by "chris hoayun" <choayun@h...> on Sun, 2 Feb 2003 10:29:33
|
|
Would that work for a text file? or just a DB?
(thx for the help)
> I'll add to this response, because I have something similar. What I'm
doing though is making a
different background color on a table with every other record. Here's an
abbreviated version of
what I did. Hope this helps.
Do While Not objPagingRS.EOF
do something here with the first (i.e., odd numbered record)
objPagingRS.MoveNext
If Not objPagingRS.EOF Then
do something here with the next (i.e., even numbered record)
End If
objPagingRS.MoveNext
Loop
----- Original Message -----
From: "Greg Griffiths" <greg2@s...>
To: "ASP Databases" <asp_databases@p...>
Sent: Saturday, February 01, 2003 10:55 AM
Subject: [asp_databases] Re: Every other line from a text file
| You will need to have some kind of counter, then you can test to see if
the
| line is one you wish to print or not.
|
| At 17:41 01/02/03 +0000, you wrote:
| >I was wondering how to create a text box which only displays lines 2, 4,
| >6, 8, ect. from a text file.
| >
| >Could anyone help?
|
|
|
|
|
Message #5 by "Pat Wong" <vinyl-junkie@n...> on Sun, 2 Feb 2003 06:35:43 -0800
|
|
Sorry, I have no idea. Perhaps a more experienced person could answer. I'm still fairly new to
all this.
----- Original Message -----
From: "chris hoayun" <choayun@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Sunday, February 02, 2003 10:29 AM
Subject: [asp_databases] Re: Every other line from a text file
| Would that work for a text file? or just a DB?
|
| (thx for the help)
|
|
| > I'll add to this response, because I have something similar. What I'm
| doing though is making a
| different background color on a table with every other record. Here's an
| abbreviated version of
| what I did. Hope this helps.
|
| Do While Not objPagingRS.EOF
| do something here with the first (i.e., odd numbered record)
| objPagingRS.MoveNext
| If Not objPagingRS.EOF Then
| do something here with the next (i.e., even numbered record)
| End If
| objPagingRS.MoveNext
| Loop
|
|
| ----- Original Message -----
| From: "Greg Griffiths" <greg2@s...>
| To: "ASP Databases" <asp_databases@p...>
| Sent: Saturday, February 01, 2003 10:55 AM
| Subject: [asp_databases] Re: Every other line from a text file
|
|
| | You will need to have some kind of counter, then you can test to see if
| the
| | line is one you wish to print or not.
| |
| | At 17:41 01/02/03 +0000, you wrote:
| | >I was wondering how to create a text box which only displays lines 2, 4,
| | >6, 8, ect. from a text file.
| | >
| | >Could anyone help?
| |
| |
| |
| |
| |
|
|
Message #6 by Greg Griffiths <greg2@s...> on Sun, 02 Feb 2003 14:02:47 +0000
|
|
The concept works in both environments, try something like the following
for your textfile :
Dim theLine;
for count = 0 to noLines
theLine=textFile.ReadLine
// if on an even line
if ((count mod 2)=0) then
Response.Write(theLine)
end if
next
At 10:29 02/02/03 +0000, you wrote:
>Would that work for a text file? or just a DB?
>
>(thx for the help)
>
>
> > I'll add to this response, because I have something similar. What I'm
>doing though is making a
>different background color on a table with every other record. Here's an
>abbreviated version of
>what I did. Hope this helps.
>
>Do While Not objPagingRS.EOF
> do something here with the first (i.e., odd numbered record)
> objPagingRS.MoveNext
> If Not objPagingRS.EOF Then
> do something here with the next (i.e., even numbered record)
> End If
> objPagingRS.MoveNext
>Loop
>
>
>----- Original Message -----
>From: "Greg Griffiths" <greg2@s...>
>To: "ASP Databases" <asp_databases@p...>
>Sent: Saturday, February 01, 2003 10:55 AM
>Subject: [asp_databases] Re: Every other line from a text file
>
>
>| You will need to have some kind of counter, then you can test to see if
>the
>| line is one you wish to print or not.
>|
>| At 17:41 01/02/03 +0000, you wrote:
>| >I was wondering how to create a text box which only displays lines 2, 4,
>| >6, 8, ect. from a text file.
>| >
>| >Could anyone help?
>|
>|
>|
>|
>|
>
Message #7 by "chris hoayun" <choayun@h...> on Sun, 2 Feb 2003 17:42:52
|
|
Dim MyFileObj
Set MyFileObj = Server.CreateObject
("Scripting.FileSystemObject")
Set MyTextFile = MyFileObj.OpenTextFile(Server.MapPath
("guestbook.txt"))
Dim strTextFile
strTextFile = MyTextFile.ReadAll
Set MyFileObj = Nothing
Dim strFileArray
strFileArray = Split(strTextFile, vbCrLf)
Dim iLoop
For iLoop = 0 to UBound(strFileArray)
If iLoop MOD 2 = 1 Then
Response.Write(strFileArray(iLoop) & Chr(10))
End IF
Next
MyTextFile.Close
This is the finished script (for anyone that cares) a friend helped me
with it! i dont suppose anyone here would know how to make it so, that it
would write the contents of a texbox into a text file?
I'm still learning asp, but from what i can see i would have to do it a
different way from above!
thx in advance :D
p.s thx for everyone that helped!
> The concept works in both environments, try something like the following
for your textfile :
Dim theLine;
for count = 0 to noLines
theLine=textFile.ReadLine
// if on an even line
if ((count mod 2)=0) then
Response.Write(theLine)
end if
next
At 10:29 02/02/03 +0000, you wrote:
>Would that work for a text file? or just a DB?
>
>(thx for the help)
>
>
> > I'll add to this response, because I have something similar. What I'm
>doing though is making a
>different background color on a table with every other record. Here's an
>abbreviated version of
>what I did. Hope this helps.
>
>Do While Not objPagingRS.EOF
> do something here with the first (i.e., odd numbered record)
> objPagingRS.MoveNext
> If Not objPagingRS.EOF Then
> do something here with the next (i.e., even numbered record)
> End If
> objPagingRS.MoveNext
>Loop
>
>
>----- Original Message -----
>From: "Greg Griffiths" <greg2@s...>
>To: "ASP Databases" <asp_databases@p...>
>Sent: Saturday, February 01, 2003 10:55 AM
>Subject: [asp_databases] Re: Every other line from a text file
>
>
>| You will need to have some kind of counter, then you can test to see if
>the
>| line is one you wish to print or not.
>|
>| At 17:41 01/02/03 +0000, you wrote:
>| >I was wondering how to create a text box which only displays lines 2,
4,
>| >6, 8, ect. from a text file.
>| >
>| >Could anyone help?
>|
>|
>|
>|
>|
>
Message #8 by "Kim Iwan Hansen" <kimiwan@k...> on Sun, 2 Feb 2003 18:27:45 +0100
|
|
You can use the SkipLine() method of the TextStream object:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/ht
ml/jsmthskipline.asp
-Kim
-----Original Message-----
From: chris hoayun [mailto:choayun@h...]
Sent: 1. februar 2003 17:41
To: ASP Databases
Subject: [asp_databases] Every other line from a text file
I was wondering how to create a text box which only displays lines 2, 4,
6, 8, ect. from a text file.
Could anyone help?
Message #9 by "Anand" <info@s...> on Mon, 3 Feb 2003 12:11:25 +0530
|
|
I think u must use array and then use mode.
Thanks and regards
Anand Bisht
eBusiness Application Developer - Consultant
668, 6th Main, 7th Cross, HAL 2nd Stage,
Indiranagar, Bangalore - 560008 (India)
E-mail: info@s...
Phone Res: +xx xx xxxxxxx
Phone Off: +xx xx xxxxxxx / xxxxxxx x 24
----- Original Message -----
From: "chris hoayun" <choayun@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Saturday, February 01, 2003 5:41 PM
Subject: [asp_databases] Every other line from a text file
> I was wondering how to create a text box which only displays lines 2, 4,
> 6, 8, ect. from a text file.
>
> Could anyone help?
|
|
 |