private void ListeBases(string conStr) { listeBd.Items.Clear(); List <string> db = AccèsSQL.GetDatabases(conStr); if (db != null) { foreach (string s in db) { listeBd.Items.Add(s); } listeBd.SelectedIndex = 0; } }
private void choixServeurButton_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; List <string> servers = AccèsSQL.GetSQLServerInstances(); if (servers.Count > 0) { listeServeurs.Items.Clear(); foreach (string s in servers) { listeServeurs.Items.Add(s); } listeServeurs.SelectedIndex = 0; } options.Serveur_Base_de_données = (string)listeServeurs.SelectedItem; ListeBases(options.Chaine_Base_de_données); Cursor = Cursors.Default; }
private void ReverseEngineer(string baseSQL) { base_données = baseSQL; this.Text = baseSQL; AccèsSQL AccSQL = new AccèsSQL(baseSQL); Point point = new Point(10, 23); foreach (DataTable d in AccSQL.Tables) { if (d.TableName != "sysdiagrams") { Relation r = new Relation(point, option.Taille_Noeud, option.Couleur_Noeud, option.Épaisseur_Noeud, d); noeuds.Add(r); } } //foreach (DataTable d in AccSQL.ForeignKeys) //{ // Contrainte c = new //} Relation r1 = null, r2 = null; Champ chSource = null, chDest = null; for (int i = 0; i < AccSQL.ForeignKeys.Rows.Count; i++) { foreach(Relation r in noeuds) { if(r.Texte == AccSQL.ForeignKeys.Rows[i].ItemArray[2].ToString()) r1 = r; if(r.Texte == AccSQL.ForeignKeys.Rows[i].ItemArray[8].ToString()) r2 = r; } foreach(Champ ch in r1.Champs) { if(ch.Nom == AccSQL.ForeignKeys.Rows[i].ItemArray[3].ToString()) chSource = ch; } foreach(Champ ch in r2.Champs) { if(ch.Nom == AccSQL.ForeignKeys.Rows[i].ItemArray[9].ToString()) chDest = ch; } Contrainte c = new Contrainte(r1, r2, Color.Black, 2,chSource,chDest); traits.Add(c); } }