Example #1
0
        private void copyTmpToOperator()
        {
            cKoneksi koneksi = new cKoneksi();

            using (var conn = new SQLiteConnection(koneksi.LokasiSqlite()))//koneksi ke sqlite
            {
                try
                {
                    conn.Open();//buka koneksi
                    using (var cmd = new SQLiteCommand(conn))
                    {
                        using (var transaction = conn.BeginTransaction())
                        {
                            cQuery qr = new cQuery();
                            cmd.CommandText = qr.qCopyTmpToOperator();//"INSERT INTO user SELECT * FROM userTmp";//query copy table
                            cmd.ExecuteNonQuery();

                            transaction.Commit();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    conn.Close(); //tutup koneksi
                    conn.Dispose();
                }
            }
        }