Click here to Skip to main content
12,891,744 members (49,265 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)

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

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);


catch (Exception ex)

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.170424.1 | Last Updated 21 Nov 2012
Copyright © CodeProject, 1999-2017
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