Hello, I have a CSV file that has a dynamic number of columns and rows. I would like for each value in a row to be in an array and then that row to be in an array therefore creating a multidimensional array. I need this done in ASP. I am a PHP developer so ASP is a bit out of my grasp. Any help would greatly appreciated. I have some code developed to do this but no where near to being done. Can someone help me out here? Thanks.

Are you sure you don't mean ASP.NET? While there are still quife a bit of ASP sites out there, new development is ASP is not common.

Member Avatar for LastMitch

While there are still quife a bit of ASP sites out there, new development is ASP is not common.

I didn't know that.

@LastMitch-

sure, I still come accross some customers that have had web applications running for several years where the site was written in ASP, but the customer may be looking for a new facelift, more functionality, improved performance, etc... I dont have actual numbers or stats on the percentage of websites written using different server scripting languages, but I am not that surprised to see classic asp sites out there. The feedback I have heard on several occassions when I ask why the sites have not been upgraded in the past is simply, why incur the costs to upgrade when the site is working perfectly fine.

I would tend to agree... Its hard to justify the costs regarding converting asp to asp.net unless its time to incorporate changes into the site where asp doesnt cut it any longer.

For new projects, i dont see any benefit of developing a classic asp site. if server side processing is required, I would suggest either php, or asp.net. For intranet stuff I work on, I generally work with IIS/asp.net mainly because of the benefits of windows authentication and just because I have more experience with asp.net.

Thanks for your feed back guys. I do in fact mean asp.net. I apoligize for not making that clearer. Here is what I have so far: (Still missing the multidimensional part of it :( )

<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("CSV_FILE_HERE.csv"), 1)

Dim intCounter
intCounter = 0

Dim SchoolArray
SchoolArray = Array()

Dim Schools
Schools = Array()

do while f.AtEndOfStream = false
ReDim Preserve SchoolArray(intCounter)
SchoolArray(intCounter) = f.ReadLine
intCounter = intCounter + 1
loop

f.Close
Set f=Nothing
Set fs=Nothing

response.write(SchoolArray(12596)) 'Output array contents like this

%>

So the code you provided is actual classic ASP, not asp.net. If you are interested in working with multidimensional arrays in asp.net, here is a discussion on the asp.net forum which provides a good example. http://forums.asp.net/t/1179543.aspx/1

for classic ASP, here is a pretty good example i found on how to take a typical table of data and store it in a multidimensional array: http://www.codefixer.com/tutorials/multidimensional_arrays.asp

commented: Good Example! +9
Member Avatar for LastMitch

For intranet stuff I work on, I generally work with IIS/asp.net mainly because of the benefits of windows authentication and just because I have more experience with asp.net.

I think I might start read up on asp.net a little. Just to get a feel on how it works. It's bit difference from asp not much but little different.

@LastMitch-That's interesting.... lately i have been feeling like i should be learning PHP. Give asp.net a try... i've been working with vb, I feel like I should have gone with c# instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.