Beispiel #1
0
        private bool ExcuteSQL(string sql)
        {
            if (sql == null || sql.Length == 0)
            {
                return(true);
            }
#if (DEBUG)
            using (IDbCommand _command = BDPPCDatabase.DebugDBConnection().Connection.CreateCommand())
#else
            using (IDbCommand _command = BDPPCDatabase.DBConnection.Connection.CreateCommand())
#endif
            {
                _command.CommandText = sql;
                _command.ExecuteNonQuery();
            }
            return(true);
        }
Beispiel #2
0
        private void ExecuteScript(ArrayList script)
        {
            progressBar1.Minimum = 0;
            progressBar1.Maximum = script.Count;
#if (DEBUG)
            using (IDbCommand _command = BDPPCDatabase.DebugDBConnection().Connection.CreateCommand())
#else
            using (IDbCommand _command = BDPPCDatabase.DBConnection.Connection.CreateCommand())
#endif
            {
                for (int i = 0; i < script.Count; i++)
                {
                    _command.CommandText = (string)script[i];
                    _command.ExecuteNonQuery();

                    if (i % 100 == 0)
                    {
                        progressBar1.Value = i;
                    }
                }
            }
            MessageBox.Show("Ok");
        }
Beispiel #3
0
        private void ExecuteScript(string[] script)
        {
            progressBar1.Minimum = 0;
            progressBar1.Maximum = script.Length;
#if (DEBUG)
            using (IDbCommand _command = BDPPCDatabase.DebugDBConnection().Connection.CreateCommand())
#else
            using (IDbCommand _command = BDPPCDatabase.DBConnection.Connection.CreateCommand())
#endif
            {
                foreach (string sql in script)
                {
                    _command.CommandText = sql;
                    _command.ExecuteNonQuery();
                    progressBar1.Value++;
                    if (progressBar1.Value % 100 == 0)
                    {
                        progressBar1.Update();
                    }
                }
            }
            MessageBox.Show("Ok");
        }