Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 MS-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
0 OriginalGriff 374
1 Sergey Alexandrovich Kryukov 362
2 Abdul Samad KP 145
3 CPallini 130
4 Richard MacCutchan 110
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,680
2 CPallini 4,850
3 George Jonsson 3,454
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2014
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