Click here to Skip to main content
12,293,601 members (66,624 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0 Access
I have to insert large text file(10,000 lines) in access database field (coloum).But the problem is when i insert large there is data shifting.
i.e when i check the original file with the file i have inserted in database , data is not inserted sequentially. but same code works with small text file.

Here is the code for inserting file in database

private void insert(object sender, EventArgs e)
{

try
{
con = new OleDbConnection(@"Provider = Microsoft.JET.OLEDB.4.0;data source =EDMDatabase.mdb;Jet OLEDB:Database password =;");
con.Open();

file2 = new StreamReader(Application.StartupPath + "\\" + "FLEXPMAC.DAT");

while (file2.EndOfStream==false)
{
string setupstr1 = null;

if (file2.ReadLine() != null)
setupstr1 = file2.ReadLine();


//Inserting text file in database(EDMDatabase.mdb) table(ex) column(xyz)

cmd = new OleDbCommand("insert into ex (xyz) values('" + setupstr1 + "')", con);

cmd.ExecuteNonQuery();
}

}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

Please help...where i can find the anwer..and thanxs in advance.
Posted 20-Nov-12 19:06pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100