public SchemaReaderClass.Tables GetTables(DbProviderFactory fac, string con) { var sr = new SchemaReaderClass(); SchemaReaderClass.Tables tables = sr.LoadTables(MakeSingular, fac, con); return(tables); }
private void LoadTreeNodes(SchemaReaderClass.Tables tbs) { treeView1.Nodes.Clear(); List <TreeNode> tns = new List <TreeNode>(); foreach (var tb in tbs) { string schema = tb.Schema.IsNullOrWhiteSpace() ? "NULL" : tb.Schema; string table = tb.Name; var find = tns.Find(s => s.Text == schema); if (find == null) { TreeNode tn = new TreeNode(schema); find = tn; tns.Add(find); } TreeNode it = new TreeNode(table); it.Tag = tb; find.Nodes.Add(it); } foreach (TreeNode tn in tns) { treeView1.Nodes.Add(tn); } }
private void modernButton2_Click(object sender, EventArgs e) { connectionstring = "datasource=" + modernTextBox1.Text; try { NewGenerator(); SchemaReaderClass.Tables tbs = GeneratorTables.GetInstance().GetTables(SQLiteFactory.Instance, connectionstring); LoadTreeNodes(tbs); } catch (Exception ex) { tips.Text = ex.Message; } }
private void modernButton3_Click(object sender, EventArgs e) { MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(); sb.Server = modernTextBox2.Text; sb.Port = uint.Parse(modernTextBox3.Text); sb.UserID = modernTextBox4.Text; sb.Password = modernTextBox5.Text; connectionstring = sb.ConnectionString; try { NewGenerator(); SchemaReaderClass.Tables tbs = GeneratorTables.GetInstance().GetTables(MySqlClientFactory.Instance, connectionstring); LoadTreeNodes(tbs); } catch (Exception ex) { tips.Text = ex.Message; } }
private void modernButton4_Click(object sender, EventArgs e) { OracleConnectionStringBuilder sb = new OracleConnectionStringBuilder(); sb.DataSource = modernTextBox9.Text; sb.UserID = modernTextBox8.Text; sb.Password = modernTextBox6.Text; sb.ConnectionTimeout = 99999; connectionstring = sb.ConnectionString; try { NewGenerator(); SchemaReaderClass.Tables tbs = GeneratorTables.GetInstance().GetTables(OracleClientFactory.Instance, connectionstring); LoadTreeNodes(tbs); } catch (Exception ex) { tips.Text = ex.Message; } }