Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

when i insert to sqlight data from my C# program it tooks

$
0
0

hi

i insert the data like this but it Takes too long 

for 34,000 records it took 20 minuts !!  (for example if i insert to sqlCE it tooks 3 minuts)

conn_sql = new SQLiteConnection(conn_str2);
conn_sql.Open();
cmd_sql = conn_sql.CreateCommand();

for (int i = 0; i < iTotalRows; i++)
{
                try { Makat = dsView.Tables["Items"].Rows[i]["Makat"].ToString().Trim(); }
                catch { Makat = ""; }
                try { Barcode = dsView.Tables["Items"].Rows[i]["Barcode"].ToString().Trim(); }
                catch { Barcode = ""; }
                try { Des = dsView.Tables["Items"].Rows[i]["Des"].ToString().Trim(); }
                catch { Des = ""; }
                try { Price = dsView.Tables["Items"].Rows[i]["Price"].ToString().Trim(); }
                catch { Price = ""; }

                SQL = "INSERT INTO Catalog(Makat,Barcode,Des,Price)VALUES('" + Makat + "','" + Barcode + "','" + Des + "','" + Price + "')";
                cmd_sql.CommandText = SQL;
                cmd_sql.CommandType = CommandType.Text;
                cmd_sql.ExecuteNonQuery();
                //cmd_sql.Dispose();
            }

how to insert Faster ?


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>