PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET convert comma delimited text to access mdb

Reply

convert comma delimited text to access mdb

 
Thread Tools Rate Thread
Old 06-02-2006, 03:36 PM   #1
jj
Guest
 
Posts: n/a
Default convert comma delimited text to access mdb


I have this comma delimited text file. I want to convert it in one sweep to
an access DB (mdb) format. I used the following code but it takes forever to
convert. Is there a faster way?

string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
strAppPath + "\\mydb.mdb";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd = new OleDbCommand("INSERT INTO mytable Select * from [Text;DATABASE="
+ strAppPath + ";].[mytextdata.txt]",conn );
cmd.ExecuteNonQuery();
conn.Close();


Any help is greatly appreicated and thank you in advance.



  Reply With Quote
Old 06-02-2006, 03:44 PM   #2
Griff
Guest
 
Posts: n/a
Default Re: convert comma delimited text to access mdb

Is this a one-off task or something that you would need to do every time a
program runs?

I don't know much about Access, but with SQL Server it's possible to do a
bulk insert which can be frighteningly fast.


  Reply With Quote
Old 06-02-2006, 03:49 PM   #3
jj
Guest
 
Posts: n/a
Default Re: convert comma delimited text to access mdb

The conversion is done at the end of my scan application. For a one
scan(that takes long hours) I will do the conversion at the end inorder to
create reports.

any help please


"Griff" <howling@the.moon> wrote in message
news:OtwBKRzKGHA.140@TK2MSFTNGP12.phx.gbl...
> Is this a one-off task or something that you would need to do every time a
> program runs?
>
> I don't know much about Access, but with SQL Server it's possible to do a
> bulk insert which can be frighteningly fast.
>
>



  Reply With Quote
Old 06-02-2006, 07:31 PM   #4
jj
Guest
 
Posts: n/a
Default Re: convert comma delimited text to access mdb

can you send me the one for SQl server and then I can try to modfiy for
Access.

Thanks

"Griff" <howling@the.moon> wrote in message
news:OtwBKRzKGHA.140@TK2MSFTNGP12.phx.gbl...
> Is this a one-off task or something that you would need to do every time a
> program runs?
>
> I don't know much about Access, but with SQL Server it's possible to do a
> bulk insert which can be frighteningly fast.
>
>



  Reply With Quote
Old 06-02-2006, 07:51 PM   #5
Paul Clement
Guest
 
Posts: n/a
Default Re: convert comma delimited text to access mdb

On Mon, 6 Feb 2006 10:36:00 -0500, "jj" <jj@hotmail.com> wrote:

¤ I have this comma delimited text file. I want to convert it in one sweep to
¤ an access DB (mdb) format. I used the following code but it takes forever to
¤ convert. Is there a faster way?
¤
¤ string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
¤ strAppPath + "\\mydb.mdb";
¤ OleDbConnection conn = new OleDbConnection(strConn);
¤ conn.Open();
¤ OleDbCommand cmd = new OleDbCommand();
¤ cmd = new OleDbCommand("INSERT INTO mytable Select * from [Text;DATABASE="
¤ + strAppPath + ";].[mytextdata.txt]",conn );
¤ cmd.ExecuteNonQuery();
¤ conn.Close();

How many lines are there in your text file?

Just an FYI, there is no bulk insert capability in Jet.


Paul
~~~~
Microsoft MVP (Visual Basic)
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off