Opening .txt or .csv as recordset

Results 1 to 2 of 2

Thread: Opening .txt or .csv as recordset

  1. #1
    Kim C Guest

    Default Opening .txt or .csv as recordset

    Hi, I need to open either a .txt or .csv file as recordset to update some tables at my website. I read Abd Shomad&#039s article at but that uses a dsn call. Is there anyway I can make a simple dsn-less call like for example:<BR><BR>Set Conntemp = Server.CreateObject("ADODB.Connection")<BR>Conntem p.Open "DBQ=" & server.mapPath("..Importdata.csv" & ";Driver={Microsoft Text Driver (*.txt; *.csv)}"<BR><BR>sql = "SELECT Field1, Field2 FROM data.csv"<BR>set rs = conn.execute(sql)<BR><BR>I can&#039t get it to work. Can you?<BR><BR>Kim<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Opening .txt or .csv as recordset

    I&#039ve only been able to get it to work with csv&#039s...<BR><BR>Provider=Microsoft.Jet.OLEDB.4 .0;Extended Properties=Text;" & _<BR>"Persist Security Info=False;Data Source=" & _<BR>DirectoryNameWhereTheCSVFileIsLocated<BR><BR> Set Conntemp = Server.CreateObject ("ADDODB.Connection")<BR> sConnect<BR><BR>Set rsFrom = Server.CreateObject ("ADODB.Recordset")<BR>rsFrom.Open "select * from `" & Replace(Filename [with the .csv but without the path], ".", "#") & "`", Conntemp, 3, 3<BR><BR>Note the backward quotes and the # in the file name<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