示例#1
0
        private void cb_connexion_SelectedIndexChanged(object sender, EventArgs e)
        {
            int x = cb_connexion.SelectedIndex;

            if (x >= -1)
            {
                groupBox1.Enabled = true;
                tb_name.Text      = tb_connectionstring.Text = tb_database.Text = tb_fichier.Text = tb_login.Text = tb_password.Text = tb_port.Text = tb_server.Text = "";

                int y = QueryLauncher.GetSGBD(QueryLauncher.connexions[x].SGBD.ToString());
                if (y > -1)
                {
                    cb_database.SelectedIndex = y;
                }

                tb_name.Text             = QueryLauncher.connexions[x].Name;
                tb_server.Text           = QueryLauncher.connexions[x].Server;
                tb_port.Text             = QueryLauncher.connexions[x].Port.ToString();
                tb_database.Text         = QueryLauncher.connexions[x].Database;
                tb_login.Text            = QueryLauncher.connexions[x].Login;
                tb_password.Text         = QueryLauncher.connexions[x].Password;
                tb_fichier.Text          = QueryLauncher.connexions[x].Fichier;
                tb_connectionstring.Text = QueryLauncher.connexions[x].ConnectionString;
            }
        }
示例#2
0
 private void b_test_Click(object sender, EventArgs e)
 {
     if (cb_connexion.SelectedIndex > -1)
     {
         Connexion co = new Connexion {
             SGBD = ((SGBD)cb_database.SelectedItem).Nom, ConnectionString = tb_connectionstring.Text
         };
         IDatabase dbtest = QueryLauncher.Connect(co);
         MessageBox.Show((dbtest.Connected) ? "Connexion OK" : "Erreur de connexion : " + dbtest.LastError);
     }
 }
示例#3
0
        public String BuildConnectionString()
        {
            String connectionString = "";
            SGBD   s = QueryLauncher.sgbds[QueryLauncher.GetSGBD(SGBD)];

            connectionString = s.DefaultConnectionString.Replace("{server}", Server)
                               .Replace("{login}", Login)
                               .Replace("{password}", Password)
                               .Replace("{database}", Database)
                               .Replace("{port}", Port.ToString())
                               .Replace("{fichier}", Fichier);

            return(connectionString);
        }
示例#4
0
        public ConnectManager(QueryLauncher parent)
        {
            InitializeComponent();
            this.parent = parent;

            cb_connexion.Items.AddRange(QueryLauncher.connexions.ToArray());

            foreach (SGBD s in QueryLauncher.sgbds)
            {
                cb_database.Items.Add(s);
            }
            cb_database.SelectedIndex = 0;

            groupBox1.Enabled = false;
        }