Exemple #1
0
        async private void btnChangeConnectionString_Click(object sender, EventArgs e)
        {
            AccessFDB fdb = null;

            switch (_providerId)
            {
            case "mssql":
                fdb = new SqlFDB();
                break;

            case "postgres":
                fdb = new pgFDB();
                break;

            case "sqlite":
                fdb = new SQLiteFDB();
                break;
            }

            if (fdb == null)
            {
                return;
            }

            await fdb.Open(_connectionString);

            DbConnectionString dbConnStr = new DbConnectionString();

            dbConnStr.UseProviderInConnectionString = false;
            FormConnectionString dlg = (dbConnStr.TryFromConnectionString("mssql", fdb.ConnectionString) ?
                                        new FormConnectionString(dbConnStr) : new FormConnectionString());

            dlg.ProviderID = _providerId;
            dlg.UseProviderInConnectionString = false;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                dbConnStr         = dlg.DbConnectionString;
                _connectionString = dbConnStr.ConnectionString;

                await BuildList();
            }
        }
        private void btnChangeConnectionString_Click(object sender, EventArgs e)
        {
            AccessFDB fdb = (_providerId == "mssql" ? new SqlFDB() : new AccessFDB());

            fdb.Open(_connectionString);

            DbConnectionString dbConnStr = new DbConnectionString();

            dbConnStr.UseProviderInConnectionString = false;
            FormConnectionString dlg = (dbConnStr.TryFromConnectionString("mssql", fdb.ConnectionString) ?
                                        new FormConnectionString(dbConnStr) : new FormConnectionString());

            dlg.ProviderID = _providerId;
            dlg.UseProviderInConnectionString = false;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                dbConnStr         = dlg.DbConnectionString;
                _connectionString = dbConnStr.ConnectionString;

                BuildList();
            }
        }