SQLite批量数据执行

时间:2016-09-07 21:20:30

标签: sqlite

执行55000行插入语句需要72分钟。我确实已经在Sqlite中构建了我的Schema ..请帮我快速完成

public static void ExecuteSqlite()
    {
        var strConnection = new SQLiteConnection("Data Source = C:\\SMS\\SMS.Database\\SQLiteDatabase\\ESMS.db; Version = 3");
        string strCommand = File.ReadAllText(@"C:\SMS\SMS.Database\SqliteFile\file.txt");
        using (SQLiteConnection db = new SQLiteConnection(strConnection))
        {
            db.Open();
            var stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();

            using (SQLiteCommand objCommand = db.CreateCommand())
            {
                using (var transaction = db.BeginTransaction())
                {

                        objCommand.CommandText = strCommand;
                        objCommand.ExecuteNonQuery();
                        transaction.Commit();
                }
            }

0 个答案:

没有答案