Solved

csv and oledb ?

Posted on 2004-10-07
3
711 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:gregasm
ID: 12255931
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
ID: 12263167
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
ID: 12263500
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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