private void ManagerTool_Load(object sender, EventArgs e) { String myConnectionString = "SERVER=127.0.0.1;UID=root;" + "PASSWORD=;database=gestor;"; ConnectionData = new HandlerConnection(myConnectionString); var data = ConnectionData.ConfirmationOfConnection(); MessageBox.Show(data.message); UserData = new UserManager(ConnectionData); var table = UserData.GetTables(); var treeTableNode = UserData.GeTreeNode(table, "TABLE_NAME", "Table"); treeView1.Nodes.Add(treeTableNode); foreach (TreeNode child in treeTableNode.Nodes) { var childname = child.Text; var childcolum = UserData.GetColumnOfTable(childname); var columname = childcolum.Select("COLUMN_NAME <> ''"); var arrayCols = columname.Select(row => new TreeNode((string)row["COLUMN_NAME"])).ToArray(); // child.Nodes.Add(new TreeNode("Columnas", arrayCols)); } var procedure = UserData.GetProcedure(); var treeProcedureNode = UserData.GeTreeNode(procedure, "SPECIFIC_NAME", "procedimientos"); treeView1.Nodes.Add(treeProcedureNode); var functions = UserData.GetFunctions(); var treeFunctionsnode = UserData.GeTreeNode(functions, "SPECIFIC_NAME", "Functions"); treeView1.Nodes.Add(treeFunctionsnode); var triggers = UserData.GetTrigger(); var treeTriggersNode = UserData.GeTreeNode(triggers, "TRIGGER_NAME", "Disparadores"); treeView1.Nodes.Add(treeTriggersNode); var Views = UserData.GetView(); var treeViewsNode = UserData.GeTreeNode(Views, "TABLE_NAME", "Views"); treeView1.Nodes.Add(treeViewsNode); //treeNode = new TreeNode("Procedimientos", x); // treeView1.Nodes.Add(treeNode); this.dataGridView1.DataSource = Views; }
private void BotonLogin_Click(object sender, EventArgs e) { string conect = "SERVER=127.0.0.1" + ";UID=" + this.TexBoxUser.Text + ";PASSWORD=;database=" + this.textBoxDatabase.Text + ";"; _handleConn = new HandlerConnection(conect); _handleConn.InformationUser(this.textBoxDatabase.Text, this.TexBoxUser.Text, this.textBoxLocalHost.Text); MessageBox.Show(_handleConn.userInfo.user + _handleConn.userInfo.Server, _handleConn.userInfo.database); var dataConnection = _handleConn.ConfirmationOfConnection(); MessageBox.Show(dataConnection.message); if (dataConnection.Confirmation) { MessageBox.Show("Bienvenido" + this.TexBoxUser.Text); ManagerTool mt = new ManagerTool(); MessageBox.Show(_handleConn.connectionString); this.Hide(); mt.Show(this); } /* * try * { * * //MySql.Data.MySqlClient.MySqlCommand SelectCommand = new MySql.Data.MySqlClient.MySqlCommand("SELECT * FROM gest.user where user_name ='" + this.TexBoxUser.Text + "' and user_password ='******';",conn); * MySql.Data.MySqlClient.MySqlDataReader myReader; * * * //myReader = SelectCommand.ExecuteReader(); * int count = 0; * while (myReader.Read()) * { * count = count + 1; * } * if (count == 1) * { * * } * } * catch (MySql.Data.MySqlClient.MySqlException ex) * { * MessageBox.Show(ex.Message); * * * * } * * */ }