private void CargarConexiones() { conn connection = new conn("localhost", "gestorbd", "BaDa10$"); conn.DRResponse response; conn.DRResponse response2; try { lblError.Text = ""; divConexines.InnerHtml = "<ul id='jstree_conexiones'>"; var sql = "SELECT NOMBRE, USUARIO, CLAVE FROM CONEXION"; response = connection.ExecuteReader(sql); while (response.DataReader.Read()) { var nombre_conexion = response.DataReader["NOMBRE"].ToString(); var usuario_bd = response.DataReader["USUARIO"].ToString(); var password_bd = response.DataReader["CLAVE"].ToString(); var icon_bd = "data-jstree='{\"icon\":\"fas fa-database\"}'"; var icon_table = "data-jstree='{\"icon\":\"fas fa-table\"}'"; var icon_edit = "data-jstree='{\"icon\":\"fas fa-edit\"}'"; divConexines.InnerHtml += ($"<li {icon_bd} >{nombre_conexion}"); //leer las tablas del Usuario conn con_tables = new conn("localhost", usuario_bd, password_bd); sql = $"SELECT owner, table_name FROM all_tables WHERE OWNER = '{usuario_bd.ToUpper()}'"; response2 = con_tables.ExecuteReader(sql); if (response2.DataReader.HasRows) { divConexines.InnerHtml += "<ul>"; divConexines.InnerHtml += ($"<li onclick='cargar_wi_edit_connection();' data-toggle='modal' data-target='#myModal' class='wi-edit-connection' {icon_edit}>Editar conexion</li>"); divConexines.InnerHtml += ($"<li>Tablas"); divConexines.InnerHtml += "<ul>"; while (response2.DataReader.Read()) { divConexines.InnerHtml += ($"<li {icon_table}>{response2.DataReader["table_name"]}</li>"); } divConexines.InnerHtml += "</ul>"; divConexines.InnerHtml += ($"</li>"); divConexines.InnerHtml += "</ul>"; } response2.DataReader.Close(); response2.Connection.Close(); divConexines.InnerHtml += "</li>"; } response.DataReader.Close(); response.Connection.Close(); divConexines.InnerHtml += "</ul>"; } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void btnejecutar_Click(object sender, EventArgs e) { try { lblError.Text = ""; var sql = sqltext.Text; conn connection = new conn("localhost", "Hr", "hr"); //conn connection = new conn("localhost", "gestorbd", "BaDa10$"); dgvdatos.DataSource = connection.ExecuteQuery(sql); dgvdatos.DataBind(); } catch (Exception ex) { lblError.Text = ex.Message; } }