Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2005, 08:57 AM
Authorized User
 
Join Date: Feb 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sql a .csv file

Is it possible to SQL a .csv file. The file has many rows, i have the primary key from one row and need to select all records from this row.

Thanks in advance

 
Old April 18th, 2005, 03:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, you just need a text driver, for example the Jet 4 driver which is usually used to connect to Access can also be used for text files. You need a connection string like this:
Code:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\your_path\;Extended Properties=""text;HDR=No;FMT=Delimited"""

'Note that the Data Source is the directory that contains the csv file.  
'The name of the actual file goes in the SQL statement, e.g.
oRS.Open "Select * From MyFile.csv", oConn, adOpenStatic, adLockReadOnly, adCmdText
hth
Phil
 
Old April 18th, 2005, 08:55 AM
Authorized User
 
Join Date: Feb 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank pgTips, was really helpfull






Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing CSV file into SQL from Web daniel SQL Server 2005 6 December 15th, 2006 09:48 AM
Importing csv file to SQL Server Using VB.Net ninel General .NET 0 August 8th, 2006 02:11 PM
Importing a CSV file into SQL rsmuts ASP.NET 1.0 and 1.1 Professional 2 July 24th, 2006 10:14 AM
how do I import CSV file into SQL Express 2005 victor888 C# 2005 0 March 20th, 2006 02:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.