Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                openFileDialog1.InitialDirectory = "c:\\";
                openFileDialog1.Filter           = "db files (*.db)|*.db|All files (*.*)|*.*";
                openFileDialog1.FilterIndex      = 2;
                openFileDialog1.RestoreDirectory = true;


                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    connect_To_Sql(openFileDialog1.FileName);
                }
            }
            else if (File.Exists(textBox1.Text))
            {
                connect_To_Sql(textBox1.Text);
            }
            else
            {
                connection = DatabaseConnection.CreateEmptyDb(textBox1.Text);
            }
        }
Exemplo n.º 2
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (textBox5.Text == "")
     {
         OpenFileDialog openFileDialog3 = new OpenFileDialog();
         openFileDialog3.InitialDirectory = "c:\\";
         openFileDialog3.Filter           = "db files (*.db)|*.db|All files (*.*)|*.*";
         openFileDialog3.FilterIndex      = 2;
         openFileDialog3.RestoreDirectory = true;
         if (openFileDialog3.ShowDialog() == DialogResult.OK)
         {
             connect_To_SqlMeta(openFileDialog3.FileName);
             MessageBox.Show("Connection succeeded");
             MetaDbFiller.CreateMetaTables();
             MetaDbFiller.FillMetaDb();
             MessageBox.Show("MetaDB filling Process succeeded");
         }
     }
     else if (File.Exists(textBox5.Text))
     {
         connect_To_SqlMeta(textBox5.Text);
         MessageBox.Show("Connection succeeded");
         MetaDbFiller.LoadMetaDB();
         MessageBox.Show("MetaDB filling Process succeeded");
     }
     else
     {
         MetaDbFiller.dbConnection = DatabaseConnection.CreateEmptyDb(textBox5.Text);
         MessageBox.Show("New metaDB file made");
         MetaDbFiller.CreateMetaTables();
         MetaDbFiller.FillMetaDb();
         MessageBox.Show("MetaDB filling Process succeeded");
     }
 }