Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            // save old connstrings
            string save    = ConnectionSettings.GetSettings().PDAConnectionString;
            string savePDA = ConnectionSettings.GetSettings().PDAConString;

            ConnectionSettings.GetSettings().PDAConnectionString = textBox1.Text;
            ConnectionSettings.GetSettings().PDAConString        = textBox2.Text;
            ConnectionSettings.Setup();
            // test
            DataBasePDA.Disconnect();
            try
            {
                DataBasePDA.Get();
                MessageBox.Show("Соединение установлено");
            }

            catch (SqlCeException ex)
            {
                MessageBox.Show("Соединение не установлено:\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            DataBasePDA.Disconnect();
            // set old values
            ConnectionSettings.GetSettings().PDAConnectionString = save;
            ConnectionSettings.GetSettings().PDAConString        = savePDA;
            ConnectionSettings.Setup();
        }
Exemplo n.º 2
0
 private void установитьСоединениеToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DataBasePDA.Disconnect();
     // содинение с Oracle
     try
     {
         // соединение с КПК
         DataBasePDA.Get();
         разорватьСоединениеToolStripMenuItem.Visible  = true;
         установитьСоединениеToolStripMenuItem.Visible = false;
         создатьСкриптНаБазуToolStripMenuItem.Enabled  = true;
         выполнитьСкриптToolStripMenuItem.Enabled      = true;
         ReadStruct();
         SetStruct();
     }
     catch (Exception ex)
     {
         DataBasePDA.Disconnect();
         MessageBox.Show("Соединение не установленно:\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }