473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[ASP] Open and Order CSV file

263 100+
Hi all.

I need open with ASP one CSV file and order this file with field DESCRIPTION.

Can you help me?

kind regards
viki
Nov 4 '08 #1
1 3385
jhardman
3,406 Expert 2GB
I googled the following words: "csv ado db driver asp"

This was the top hit: "http://www.simongibson.com/intranet/adooledb/"

Here is the code they provided:
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE=VBSCRIPT%>
  2. <%
  3. Option Explicit
  4. Dim strConnection, conn, rs, strSQL
  5.  
  6. strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
  7. Server.MapPath(".\csv\") & ";Extended Properties=""text;HDR=Yes;FMT=Delimited"""
  8.  
  9. Set conn = Server.CreateObject("ADODB.Connection")
  10. conn.Open strConnection
  11.  
  12. Set rs = Server.CreateObject("ADODB.recordset")
  13. strSQL = "SELECT * FROM myFile.csv"
  14. rs.open strSQL, conn, 3,3
  15.  
  16. rs.MoveFirst
  17. WHILE NOT rs.EOF
  18.      Response.Write(rs("myColumn") & "<br/>")
  19. rs.MoveNext
  20. WEND
  21.  
  22. rs.Close
  23. Set rs = Nothing
  24.  
  25. conn.Close
  26. Set conn = Nothing
  27. %> 
To sort by a specific field, you would want to change the strSQL to be "SELECT * FROM myFile.csv ORDER BY description"

Jared
Nov 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: woodBeeProgrammer | last post by:
CONTEXT ok, so if i register the file extension .bar Windows is happy and when a user double clicks myApp gets called. but if the user double clicks my data file BEFORE i get to register, the...
3
by: RN Das | last post by:
Hi expert, I have a small web application in C# and ASP.Net and I want to open a file in notepad when clicked on a linked button. Here is hander code when clicked on the link button. It can open...
3
by: Neal | last post by:
Hi All I am trying to connect from ASP.Net app to an Access Db. If i don't specify a userid an pwd.. I get this error The Microsoft Jet database engine cannot open the file 'C:\Documents and...
4
by: Bob | last post by:
I want to open a file in a function and pass the file back to main so another function can manipulate the file, something like this: # begin def open_file()...
8
by: jnb0012 | last post by:
I am creating a webpage and have a form where a visitor will choose a day, month, and year. I want to pass the data from the form into an asp page which will process it and put it into a string...
5
by: shekhaliya | last post by:
I want to open particular PDF file in my Asp.net application. For that have store the path of PDF file in database. Now I want to open that file on one of the page in my application.
24
by: dancer | last post by:
Using ASP.net 1.1 and Microsoft Access. I received the following error message. Why? I have closed the Access file. I have another very small access file that opens with no trouble with the...
1
Soniad
by: Soniad | last post by:
Hi, I want to open an excel file from ASP Page, direclty. Means, Now I can open excel file on onclick by giving its path. But,it's prompting a dialog box with "Open/Save/Cancel" Option. ...
1
by: RomeoX | last post by:
hi everyone here, hope u r doing well My question that I want to make a page in ASP.Net based on database and I'm a newbie, recently I have got a complete project that one of my friend gave it...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.