473,399 Members | 4,177 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,399 software developers and data experts.

Connection string for text files

TF
hi,

Can anyone please tell me the ADO.NET connection string to access data
from flat files (CSV or other character delimited). I tried it with
OLE DB provider for ODBC (MSDASQL) but got error that it is not
supported in .NET.

Thanks in advance

TF
Jul 21 '05 #1
2 1207
Hi,

This one was suggested by Paul Clement a month ago or so:
Use the Jet OLEDB driver with the Text ISAM instead:

Dim TextConnectionString As String
TextConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\TestData" & ";" & _
"Extended Properties=""Text;HDR=NO;"""
Dim TextConn As New
System.Data.OleDb.OleDbConnection(TextConnectionSt ring)
TextConn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from
test.csv", TextConn)

Dim ds As DataSet = New DataSet("CSVFiles")
da.Fill(ds, "test.csv")

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"TF" <fa****@coned.com> wrote in message
news:ae**************************@posting.google.c om...
hi,

Can anyone please tell me the ADO.NET connection string to access data
from flat files (CSV or other character delimited). I tried it with
OLE DB provider for ODBC (MSDASQL) but got error that it is not
supported in .NET.

Thanks in advance

TF

Jul 21 '05 #2
TF
Thanks Miha, it is working.

"Miha Markic" <miha at rthand com> wrote in message news:<eL**************@tk2msftngp13.phx.gbl>...
Hi,

Dim TextConnectionString As String
TextConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\TestData" & ";" & _
"Extended Properties=""Text;HDR=NO;"""
Dim TextConn As New
System.Data.OleDb.OleDbConnection(TextConnectionSt ring)
TextConn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from
test.csv", TextConn)

Dim ds As DataSet = New DataSet("CSVFiles")
da.Fill(ds, "test.csv")

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jay Douglas | last post by:
Hello, I'm trying to create a Data Links Property window that behaves just like the dialog box in Visual Studio .Net for MS Sql Server connections. I've found a lot of examples that use...
1
by: sal | last post by:
Greets, All Question with udl and connection string does it work? I'm having problems with the code below I keep getting an error "Keyword not supported 'File Name'" I was just following...
2
by: gary g. | last post by:
I was wondering if it was possible to store a connection string only once in a single config file, and let it be accessible to every project in the solution (web included). This way if the...
10
by: cleo | last post by:
I am migrating from VB6/Access to Visual Basic and SQL Express. I have success writing test code on my local machine and am now setting up tests for deployment to a server. I have installed SQL...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
2
by: Brad Pears | last post by:
We have several applications that use the ".exe.config" .xml file to get the connection string to our SQL server db. Each user of the application has their own .xml file because we have some user...
3
by: =?Utf-8?B?Sm9obkJhdGVz?= | last post by:
I'm trying to (programatically) backup and clear the security event log on the local machine. I can do this manually through the event viewer and I am logged on as an administrator. I can...
1
by: eemorris | last post by:
Hi, I'm trying to use an asp page to send data from a basic HTML form to an Access database. I'm using GoDaddy hosting (which apparently many people have issues with when it comes to this) and here...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.