FrmBaseDatos, FrmDatos y FrmProcedimientos: Botón refrescar
This commit is contained in:
@@ -155,32 +155,31 @@ namespace ServerExplorer.UI
|
||||
|
||||
private void lsvTablas_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lsvTablas.SelectedItems.Count == 1)
|
||||
if (lsvTablas.SelectedItems.Count != 1) { return; }
|
||||
|
||||
// Determinar tabla seleccionada
|
||||
ListViewItem item = lsvTablas.SelectedItems[0];
|
||||
|
||||
// Recordar tabla seleccionada
|
||||
tableSchema = item.SubItems[1].Text.ToString();
|
||||
tableName = item.SubItems[0].Text.ToString();
|
||||
|
||||
// Establecer titulo de la lista de columnas
|
||||
lblTituloTabla.Text = tableSchema + "." + tableName;
|
||||
|
||||
// Obtener descripcion de tabla
|
||||
TablaDesc td = new TablaDesc();
|
||||
td.FillDesc(tableSchema, tableName, cnx);
|
||||
|
||||
// Mostrar "columnas" de las tablas
|
||||
lsvColumnas.Items.Clear();
|
||||
foreach (ColumnaDesc col in td.Columnas)
|
||||
{
|
||||
// Determinar tabla seleccionada
|
||||
ListViewItem item = lsvTablas.SelectedItems[0];
|
||||
|
||||
// Recordar tabla seleccionada
|
||||
tableSchema = item.SubItems[1].Text.ToString();
|
||||
tableName = item.SubItems[0].Text.ToString();
|
||||
|
||||
// Establecer titulo de la lista de columnas
|
||||
lblTituloTabla.Text = tableSchema + "." + tableName;
|
||||
|
||||
// Obtener descripcion de tabla
|
||||
TablaDesc td = new TablaDesc();
|
||||
td.FillDesc(item.SubItems[1].Text, item.SubItems[0].Text, cnx);
|
||||
|
||||
// Mostrar "columnas" de las tablas
|
||||
lsvColumnas.Items.Clear();
|
||||
foreach (ColumnaDesc col in td.Columnas)
|
||||
{
|
||||
ListViewItem subitem = lsvColumnas.Items.Add(col.Nombre);
|
||||
subitem.SubItems.Add(col.Tipo);
|
||||
subitem.SubItems.Add((col.Tamanho >= 0) ? String.Format("{0}", col.Tamanho) : string.Empty);
|
||||
subitem.SubItems.Add(col.Primaria ? "PK" : string.Empty);
|
||||
subitem.SubItems.Add(col.Nullable ? "Null" : "NotNull");
|
||||
}
|
||||
ListViewItem subitem = lsvColumnas.Items.Add(col.Nombre);
|
||||
subitem.SubItems.Add(col.Tipo);
|
||||
subitem.SubItems.Add((col.Tamanho >= 0) ? String.Format("{0}", col.Tamanho) : string.Empty);
|
||||
subitem.SubItems.Add(col.Primaria ? "PK" : string.Empty);
|
||||
subitem.SubItems.Add(col.Nullable ? "Null" : "NotNull");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,48 +212,18 @@ namespace ServerExplorer.UI
|
||||
|
||||
private void btnVerDatos_Click(object sender, EventArgs e)
|
||||
{
|
||||
String nombreTabla;
|
||||
DataTable dt;
|
||||
SqlDataAdapter da;
|
||||
|
||||
if (tableSchema == null || tableName == null) { return; }
|
||||
|
||||
nombreTabla = "[" + tableSchema + "].[" + tableName + "]";
|
||||
|
||||
// Obtener un datatable con todos los registros de la tabla.
|
||||
da = new SqlDataAdapter(
|
||||
"select * from " + nombreTabla,
|
||||
cnx);
|
||||
dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
// Obtener descripcion de tabla
|
||||
TablaDesc td = new TablaDesc();
|
||||
td.FillDesc(tableSchema, tableName, cnx);
|
||||
|
||||
// Crear y mostrar el formulario de los datos.
|
||||
FrmDatos form = new FrmDatos(dt, nombreTabla);
|
||||
FrmDatos form = new FrmDatos(td, config.ConnectionString);
|
||||
FrmPrincipal.AddForm(form);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void btnProcs_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*DataTable dt;
|
||||
SqlDataAdapter da;
|
||||
|
||||
// Obtener un datatable con todos los registros de la tabla.
|
||||
da = new SqlDataAdapter(
|
||||
"SELECT id,name,crdate FROM sysobjects WHERE type = 'P' AND category = 0 ORDER BY name ",
|
||||
cnx);
|
||||
dt = new DataTable();
|
||||
cnx.Open();
|
||||
da.Fill(dt);
|
||||
cnx.Close();
|
||||
|
||||
// Crear y mostrar el formulario de los datos.
|
||||
frmDatos form = new frmDatos(dt, "Procedimientos");
|
||||
FrmPrincipal.AddForm(form);*/
|
||||
|
||||
// Crear y mostrar el formulario de los procedimientos.
|
||||
FrmProcedimientos form = new FrmProcedimientos(config.ConnectionString);
|
||||
FrmPrincipal.AddForm(form);
|
||||
@@ -325,5 +294,10 @@ namespace ServerExplorer.UI
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user