Solved

csv and oledb ?

Posted on 2004-10-07
3
710 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
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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