|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
convert comma delimited text to access mdbI 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. 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. 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 Show quote "Griff" <howl***@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. > > can you send me the one for SQl server and then I can try to modfiy for
Access. Thanks Show quote "Griff" <howl***@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. > > On Mon, 6 Feb 2006 10:36:00 -0500, "jj" <j*@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) |
|||||||||||||||||||||||