How do I get column names from a csv?

Results 1 to 2 of 2

Thread: How do I get column names from a csv?

  1. #1
    Cliff W Guest

    Default How do I get column names from a csv?

    What are the column names in a recordset based on this connection string and select statement?<BR><BR>Set cnn = Server.CreateObject("ADODB.Connection")<BR>Set rs2 = Server.CreateObject("ADODB.Recordset")<BR><BR>cnn. Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:Inetpubwwwroot.esmFirefight;Extended Properties=" & chr(34) & "text;HDR=NO;FMT=Delimited" & chr(34)<BR><BR>rs2.Open "select * from file.csv", cnn, adOpenStatic<BR><BR>Are there default column names that I can use? Also, how can I put a "where" statement in my SQL string if I don&#039;t have column names?<BR>

  2. #2
    Join Date
    Dec 1969

    Default Have to connect differently...

    I never could get it to work using a DSN-less connection.<BR><BR>But it works pretty well using a "File DSN".<BR><BR>A demo of how I got it to work is HERE:<BR><BR>Look at the "Bar graphs" demo. It uses a .csv file, grabs the column names [note the quotes around the names! not sure they are needed, but it works with them]. I don&#039;t happen to use the names in a WHERE clause, but I do use them in the SELECT and they work.<BR><BR>If you figure out how to make this work DSN-less, without the file DSN, let me know!<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