Help With array

Results 1 to 2 of 2

Thread: Help With array

  1. #1
    Join Date
    Dec 1969

    Default Help With array

    I could use a little help with an array... i think. Basically I want to read in a text file such a s:<BR><BR>1 blue 555 45 $4.99<BR>2 red 897 3 $.89<BR>3 green 111 333 $23,000.00<BR>etc<BR><BR>I can read in the file and display it in asp with no problem. What I need to do is make certain item a hyperlink and so on. I have been reading about arrays, and I GUESS I should try and read each line in, and set each of the 5 columns to a variable seperating each column by the "_" . So in the loop I can use response.write to write out each html line with hyperlinks and etc.<BR><BR>I have been looking for an example of this with no luck, If anyone could point out some example code or give some pointers it would be great. I havnt worked with array&#039;s before.<BR><BR>Thanks for any help/suggestions<BR>

  2. #2
    Join Date
    Dec 1969

    Default Not really an array problem...

    ...though you can use an array to solve it.<BR><BR>Given your data:<BR>1 blue 555 45 $4.99<BR>2 red 897 3 $.89<BR><BR>And imparting my own meanings to each column...<BR><BR>&#060;%<BR>... open the file ...<BR><BR>line = theFile.ReadLine &#039; get one line from file<BR>pieces = Split( line, " " ) &#039; split the line into pieces<BR><BR>%&#062;<BR>&#060;A HREF="foo.asp?choice=&#060;% = pieces(0) %&#062;"&#062;<BR>Buy the &#060;% = pieces(1) %&#062; one. We have &#060;% = pieces(2) %&#062; left.<BR>Shipping weight is &#060;% = pieces(3) %&#062;. Cost is &#060;% = pieces(4) %&#062; each.<BR>&#060;/A&#062;<BR><BR>...<BR><BR>Look up SPLIT in the VBS docs. Don&#039;t make this harder than it is! No idea why you think you need the "_" involved, for example.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts