Solved

csv and oledb ?

Posted on 2004-10-07
3
701 Views
Last Modified: 2010-07-27


hi

I want to load from a csv file, all the data to a dataset using oledb connection.

when i use:

string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=text;";

OleDbDataAdapter oleCmd = new OleDbDataAdapter("SELECT * FROM NEWTESTApr.csv", strConn);

my code runs fine, but when i add either HDR, or FMT to the string connection like:

string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=text;HDR=No;FMT=Delimited;";
         
it gives me an exception : could not find installable ISAM.

can anyone throw more light on this .. why this is happening ?


thanks
messageman
0
Comment
Question by:messageforums
  • 2
3 Comments
 
LVL 8

Expert Comment

by:gregasm
Comment Utility
Hey messageman,

Have a look here. This might shed some light on the issue:

http://www.dotnet247.com/247reference/msgs/12/61447.aspx
0
 

Author Comment

by:messageforums
Comment Utility
hi

thanks for the link and the topic on ISAM. that was very helpful.

I did not modify any registries yet, but my question is that
if it runs for the first command that i give., then the addition of HDR or FMT should not matter as long as the connection is valid.

but why just by the addition of those will the system give errors ????


please let me know
messageman
0
 
LVL 8

Accepted Solution

by:
gregasm earned 50 total points
Comment Utility
Can you try this code?

System.Data.OleDb.OleDbConnection oConn = new
System.Data.OleDb.OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + PathtoTextFile + ";" +
"Extended Properties=\"text;HDR=YES;FMT=Delimited\"");
System.Data.OleDb.OleDbDataAdapter oCmd = new
System.Data.OleDb.OleDbDataAdapter(
"select * from csv.txt",
oConn);

DataSet myDS = new DataSet();
oCmd.Fill(myDS);
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now