mercredi 27 avril 2016

Using dataset in sqlite

I recently code a program that everyday can add or update 20000 record in sqlite. by using Stopwatch i realized that all the records would add to sqlite in about 40 minutes.

by the way this is the code for adding the records :

string q = "INSERT INTO " + title + " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                    SQLiteCommand cmd = new SQLiteCommand(q, Assist.con_database);

                    cmd.Parameters.AddWithValue("@**", null);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);

                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);
                    cmd.Parameters.AddWithValue("@**", **);

                    Assist.con_database.Open();
                    cmd.ExecuteNonQuery();
                    Assist.con_database.Close(); 

how can i reduce the time and increase the speed of adding in sqlite ?

Aucun commentaire:

Enregistrer un commentaire