(2012-03-28)

This commit is contained in:
2012-03-28 12:00:00 +02:00
parent 2260c58014
commit a2717a0661
53 changed files with 2940 additions and 169 deletions

View File

@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerExplorer", "ServerExplorer\ServerExplorer.csproj", "{79531B74-3062-4A71-9953-5702BEBDEC0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79531B74-3062-4A71-9953-5702BEBDEC0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace ServerExplorer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmPrincipal());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ServerExplorer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cyc")]
[assembly: AssemblyProduct("ServerExplorer")]
[assembly: AssemblyCopyright("Copyright © cyc 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("31f76805-336c-471c-8af2-a4c1364e97b9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ServerExplorer.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ServerExplorer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3082
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ServerExplorer.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{79531B74-3062-4A71-9953-5702BEBDEC0E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ServerExplorer</RootNamespace>
<AssemblyName>ServerExplorer</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmBaseDatos.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmBaseDatos.Designer.cs">
<DependentUpon>frmBaseDatos.cs</DependentUpon>
</Compile>
<Compile Include="frmPrincipal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmPrincipal.Designer.cs">
<DependentUpon>frmPrincipal.cs</DependentUpon>
</Compile>
<Compile Include="frmServidores.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmServidores.Designer.cs">
<DependentUpon>frmServidores.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmBaseDatos.resx">
<DependentUpon>frmBaseDatos.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPrincipal.resx">
<DependentUpon>frmPrincipal.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmServidores.resx">
<DependentUpon>frmServidores.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,182 @@
namespace ServerExplorer
{
partial class frmBaseDatos
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtConString = new System.Windows.Forms.TextBox();
this.lblConString = new System.Windows.Forms.Label();
this.btnCopiarConString = new System.Windows.Forms.Button();
this.lsvTablas = new System.Windows.Forms.ListView();
this.colNombreTabla = new System.Windows.Forms.ColumnHeader();
this.colEsquema = new System.Windows.Forms.ColumnHeader();
this.colTipo = new System.Windows.Forms.ColumnHeader();
this.lsvColumnas = new System.Windows.Forms.ListView();
this.colNombreColumna = new System.Windows.Forms.ColumnHeader();
this.colTipoDatos = new System.Windows.Forms.ColumnHeader();
this.colTamanho = new System.Windows.Forms.ColumnHeader();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// txtConString
//
this.txtConString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtConString.Location = new System.Drawing.Point(123, 12);
this.txtConString.Name = "txtConString";
this.txtConString.ReadOnly = true;
this.txtConString.Size = new System.Drawing.Size(472, 20);
this.txtConString.TabIndex = 0;
//
// lblConString
//
this.lblConString.AutoSize = true;
this.lblConString.Location = new System.Drawing.Point(12, 15);
this.lblConString.Name = "lblConString";
this.lblConString.Size = new System.Drawing.Size(105, 13);
this.lblConString.TabIndex = 1;
this.lblConString.Text = "Cadena de conexion";
//
// btnCopiarConString
//
this.btnCopiarConString.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCopiarConString.Location = new System.Drawing.Point(601, 10);
this.btnCopiarConString.Name = "btnCopiarConString";
this.btnCopiarConString.Size = new System.Drawing.Size(52, 23);
this.btnCopiarConString.TabIndex = 3;
this.btnCopiarConString.Text = "Copiar";
this.btnCopiarConString.UseVisualStyleBackColor = true;
this.btnCopiarConString.Click += new System.EventHandler(this.btnCopiarConString_Click);
//
// lsvTablas
//
this.lsvTablas.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.lsvTablas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colNombreTabla,
this.colEsquema,
this.colTipo});
this.lsvTablas.Location = new System.Drawing.Point(12, 38);
this.lsvTablas.Name = "lsvTablas";
this.lsvTablas.Size = new System.Drawing.Size(326, 426);
this.lsvTablas.TabIndex = 4;
this.lsvTablas.UseCompatibleStateImageBehavior = false;
this.lsvTablas.View = System.Windows.Forms.View.Details;
this.lsvTablas.SelectedIndexChanged += new System.EventHandler(this.lsvTablas_SelectedIndexChanged);
//
// colNombreTabla
//
this.colNombreTabla.Text = "Tabla";
this.colNombreTabla.Width = 169;
//
// colEsquema
//
this.colEsquema.Text = "Esquema";
//
// colTipo
//
this.colTipo.Text = "Tipo";
this.colTipo.Width = 71;
//
// lsvColumnas
//
this.lsvColumnas.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lsvColumnas.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colNombreColumna,
this.colTipoDatos,
this.colTamanho});
this.lsvColumnas.Location = new System.Drawing.Point(344, 38);
this.lsvColumnas.Name = "lsvColumnas";
this.lsvColumnas.Size = new System.Drawing.Size(309, 262);
this.lsvColumnas.TabIndex = 6;
this.lsvColumnas.UseCompatibleStateImageBehavior = false;
this.lsvColumnas.View = System.Windows.Forms.View.Details;
//
// colNombreColumna
//
this.colNombreColumna.Text = "Columna";
this.colNombreColumna.Width = 139;
//
// colTipoDatos
//
this.colTipoDatos.Text = "Tipo de Datos";
this.colTipoDatos.Width = 92;
//
// colTamanho
//
this.colTamanho.Text = "Tamaño";
//
// dataGridView1
//
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(344, 306);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(309, 158);
this.dataGridView1.TabIndex = 8;
//
// frmBaseDatos
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(665, 476);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.lsvColumnas);
this.Controls.Add(this.lsvTablas);
this.Controls.Add(this.btnCopiarConString);
this.Controls.Add(this.lblConString);
this.Controls.Add(this.txtConString);
this.Name = "frmBaseDatos";
this.Text = "Base de Datos";
this.Load += new System.EventHandler(this.frmBaseDatos_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtConString;
private System.Windows.Forms.Label lblConString;
private System.Windows.Forms.Button btnCopiarConString;
private System.Windows.Forms.ListView lsvTablas;
private System.Windows.Forms.ColumnHeader colNombreTabla;
private System.Windows.Forms.ColumnHeader colEsquema;
private System.Windows.Forms.ColumnHeader colTipo;
private System.Windows.Forms.ListView lsvColumnas;
private System.Windows.Forms.ColumnHeader colNombreColumna;
private System.Windows.Forms.ColumnHeader colTipoDatos;
private System.Windows.Forms.ColumnHeader colTamanho;
private System.Windows.Forms.DataGridView dataGridView1;
}
}

View File

@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
namespace ServerExplorer
{
public partial class frmBaseDatos : Form
{
SqlConnection cnx;
public frmBaseDatos(String ConString)
{
InitializeComponent();
// Establecer conexion
txtConString.Text = ConString;
cnx = new SqlConnection(ConString);
}
private void frmBaseDatos_Load(object sender, EventArgs e)
{
// Obtener lista de tablas
cnx.Open();
DataTable dt = cnx.GetSchema("Tables");
cnx.Close();
// Mostrar todas las tablas
lsvTablas.Items.Clear();
foreach (DataRow dr in dt.Rows)
{
ListViewItem item = lsvTablas.Items.Add((String)dr["TABLE_NAME"]);
item.SubItems.Add((String)dr["TABLE_SCHEMA"]);
item.SubItems.Add((String)dr["TABLE_TYPE"]);
}
}
private void btnCopiarConString_Click(object sender, EventArgs e)
{
// Copiar la cadena de conexion al portapapeles
System.Windows.Forms.Clipboard.SetText(txtConString.Text);
}
private void lsvTablas_SelectedIndexChanged(object sender, EventArgs e)
{
if (lsvTablas.SelectedItems.Count == 1)
{
DataTable dt;
// Determinar tabla seleccionada
ListViewItem item = lsvTablas.SelectedItems[0];
// Obtener las columnas de la tabla
String[] restr_columna = { null, null, item.SubItems[0].Text, null };
// NOTA: Catalog, Owner, Table, TableType
cnx.Open();
dt = cnx.GetSchema("Columns", restr_columna);
cnx.Close();
// Mostrar "columnas" de las tablas
lsvColumnas.Items.Clear();
foreach (DataRow dr in dt.Rows)
{
ListViewItem subitem = lsvColumnas.Items.Add((String)dr["COLUMN_NAME"]);
subitem.SubItems.Add((String)dr["DATA_TYPE"]);
if (dr["CHARACTER_MAXIMUM_LENGTH"] != DBNull.Value)
{
subitem.SubItems.Add(String.Format("{0}",dr["CHARACTER_MAXIMUM_LENGTH"]));
}
}
// Obtener las restricciones de la tabla
cnx.Open();
dt = cnx.GetSchema("Restrictions");
dt = cnx.GetSchema("ForeignKeys");
//dt = cnx.GetSchema("Indexes");
//dt = cnx.GetSchema("IndexColumns");
//dt = cnx.GetSchema("Constraint");
cnx.Close();
// Mostrar las columnas de la tabla restricciones
dataGridView1.DataSource = dt;
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,114 @@
namespace ServerExplorer
{
partial class frmPrincipal
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.servidorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.meiBuscarServidor = new System.Windows.Forms.ToolStripMenuItem();
this.baseDeDatosToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.meiConectarA = new System.Windows.Forms.ToolStripMenuItem();
this.meiConectarPRUEBAS = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.servidorToolStripMenuItem,
this.baseDeDatosToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 24);
this.menuStrip1.TabIndex = 4;
this.menuStrip1.Text = "menuPrincipal";
//
// servidorToolStripMenuItem
//
this.servidorToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.meiBuscarServidor});
this.servidorToolStripMenuItem.Name = "servidorToolStripMenuItem";
this.servidorToolStripMenuItem.Size = new System.Drawing.Size(59, 20);
this.servidorToolStripMenuItem.Text = "Servidor";
//
// meiBuscarServidor
//
this.meiBuscarServidor.Name = "meiBuscarServidor";
this.meiBuscarServidor.Size = new System.Drawing.Size(160, 22);
this.meiBuscarServidor.Text = "Buscar Servidor";
this.meiBuscarServidor.Click += new System.EventHandler(this.meiBuscarServidor_Click);
//
// baseDeDatosToolStripMenuItem
//
this.baseDeDatosToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.meiConectarA,
this.meiConectarPRUEBAS});
this.baseDeDatosToolStripMenuItem.Name = "baseDeDatosToolStripMenuItem";
this.baseDeDatosToolStripMenuItem.Size = new System.Drawing.Size(88, 20);
this.baseDeDatosToolStripMenuItem.Text = "Base de Datos";
//
// meiConectarA
//
this.meiConectarA.Name = "meiConectarA";
this.meiConectarA.Size = new System.Drawing.Size(186, 22);
this.meiConectarA.Text = "Conectar a...";
//
// meiConectarPRUEBAS
//
this.meiConectarPRUEBAS.Name = "meiConectarPRUEBAS";
this.meiConectarPRUEBAS.Size = new System.Drawing.Size(186, 22);
this.meiConectarPRUEBAS.Text = "Conectar a PRUEBAS";
this.meiConectarPRUEBAS.Click += new System.EventHandler(this.meiConectarPRUEBAS_Click);
//
// frmPrincipal
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 601);
this.Controls.Add(this.menuStrip1);
this.IsMdiContainer = true;
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmPrincipal";
this.Text = "Explorador de Servidores";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem servidorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem meiBuscarServidor;
private System.Windows.Forms.ToolStripMenuItem baseDeDatosToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem meiConectarA;
private System.Windows.Forms.ToolStripMenuItem meiConectarPRUEBAS;
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ServerExplorer
{
public partial class frmPrincipal : Form
{
public frmPrincipal()
{
InitializeComponent();
}
private void meiConectarPRUEBAS_Click(object sender, EventArgs e)
{
frmBaseDatos frm = new frmBaseDatos("Data Source=SSSRV3;Initial Catalog=PRUEBAS;User ID=sa;Password=SLsssrv3");
frm.MdiParent = this;
frm.Show();
}
private void meiBuscarServidor_Click(object sender, EventArgs e)
{
frmServidores frm = new frmServidores();
frm.MdiParent = this;
frm.Show();
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,216 @@
namespace ServerExplorer
{
partial class frmServidores
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lsvServidores = new System.Windows.Forms.ListView();
this.btnListarServidores = new System.Windows.Forms.Button();
this.colNombreServidor = new System.Windows.Forms.ColumnHeader();
this.colInstancia = new System.Windows.Forms.ColumnHeader();
this.colVersion = new System.Windows.Forms.ColumnHeader();
this.lblServidor = new System.Windows.Forms.Label();
this.txtServidor = new System.Windows.Forms.TextBox();
this.lblUsuario = new System.Windows.Forms.Label();
this.lblContrasenha = new System.Windows.Forms.Label();
this.txtUsuario = new System.Windows.Forms.TextBox();
this.TxtContrasenha = new System.Windows.Forms.TextBox();
this.btnListarBBDD = new System.Windows.Forms.Button();
this.lsvBBDD = new System.Windows.Forms.ListView();
this.colDBName = new System.Windows.Forms.ColumnHeader();
this.colFechaCreacion = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// lsvServidores
//
this.lsvServidores.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.lsvServidores.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colNombreServidor,
this.colInstancia,
this.colVersion});
this.lsvServidores.Location = new System.Drawing.Point(12, 42);
this.lsvServidores.Name = "lsvServidores";
this.lsvServidores.Size = new System.Drawing.Size(281, 391);
this.lsvServidores.TabIndex = 1;
this.lsvServidores.UseCompatibleStateImageBehavior = false;
this.lsvServidores.View = System.Windows.Forms.View.Details;
this.lsvServidores.SelectedIndexChanged += new System.EventHandler(this.lsvServidores_SelectedIndexChanged);
//
// btnListarServidores
//
this.btnListarServidores.Location = new System.Drawing.Point(12, 13);
this.btnListarServidores.Name = "btnListarServidores";
this.btnListarServidores.Size = new System.Drawing.Size(281, 23);
this.btnListarServidores.TabIndex = 2;
this.btnListarServidores.Text = "Listar Servidores";
this.btnListarServidores.UseVisualStyleBackColor = true;
this.btnListarServidores.Click += new System.EventHandler(this.btnListarServidores_Click);
//
// colNombreServidor
//
this.colNombreServidor.Text = "Servidor";
this.colNombreServidor.Width = 110;
//
// colInstancia
//
this.colInstancia.Text = "Instancia";
this.colInstancia.Width = 94;
//
// colVersion
//
this.colVersion.Text = "Version";
this.colVersion.Width = 73;
//
// lblServidor
//
this.lblServidor.AutoSize = true;
this.lblServidor.Location = new System.Drawing.Point(319, 18);
this.lblServidor.Name = "lblServidor";
this.lblServidor.Size = new System.Drawing.Size(46, 13);
this.lblServidor.TabIndex = 3;
this.lblServidor.Text = "Servidor";
//
// txtServidor
//
this.txtServidor.Location = new System.Drawing.Point(429, 15);
this.txtServidor.Name = "txtServidor";
this.txtServidor.Size = new System.Drawing.Size(180, 20);
this.txtServidor.TabIndex = 4;
//
// lblUsuario
//
this.lblUsuario.AutoSize = true;
this.lblUsuario.Location = new System.Drawing.Point(319, 45);
this.lblUsuario.Name = "lblUsuario";
this.lblUsuario.Size = new System.Drawing.Size(43, 13);
this.lblUsuario.TabIndex = 5;
this.lblUsuario.Text = "Usuario";
//
// lblContrasenha
//
this.lblContrasenha.AutoSize = true;
this.lblContrasenha.Location = new System.Drawing.Point(319, 70);
this.lblContrasenha.Name = "lblContrasenha";
this.lblContrasenha.Size = new System.Drawing.Size(61, 13);
this.lblContrasenha.TabIndex = 6;
this.lblContrasenha.Text = "Contraseña";
//
// txtUsuario
//
this.txtUsuario.Location = new System.Drawing.Point(429, 42);
this.txtUsuario.Name = "txtUsuario";
this.txtUsuario.Size = new System.Drawing.Size(180, 20);
this.txtUsuario.TabIndex = 7;
//
// TxtContrasenha
//
this.TxtContrasenha.Location = new System.Drawing.Point(429, 67);
this.TxtContrasenha.Name = "TxtContrasenha";
this.TxtContrasenha.Size = new System.Drawing.Size(180, 20);
this.TxtContrasenha.TabIndex = 8;
this.TxtContrasenha.UseSystemPasswordChar = true;
//
// btnListarBBDD
//
this.btnListarBBDD.Location = new System.Drawing.Point(322, 93);
this.btnListarBBDD.Name = "btnListarBBDD";
this.btnListarBBDD.Size = new System.Drawing.Size(287, 23);
this.btnListarBBDD.TabIndex = 9;
this.btnListarBBDD.Text = "Listar BBDD";
this.btnListarBBDD.UseVisualStyleBackColor = true;
this.btnListarBBDD.Click += new System.EventHandler(this.btnListarBBDD_Click);
//
// lsvBBDD
//
this.lsvBBDD.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.lsvBBDD.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colDBName,
this.colFechaCreacion});
this.lsvBBDD.Location = new System.Drawing.Point(322, 122);
this.lsvBBDD.Name = "lsvBBDD";
this.lsvBBDD.Size = new System.Drawing.Size(287, 311);
this.lsvBBDD.TabIndex = 11;
this.lsvBBDD.UseCompatibleStateImageBehavior = false;
this.lsvBBDD.View = System.Windows.Forms.View.Details;
this.lsvBBDD.DoubleClick += new System.EventHandler(this.lsvBBDD_DoubleClick);
//
// colDBName
//
this.colDBName.Text = "Base de Datos";
this.colDBName.Width = 165;
//
// colFechaCreacion
//
this.colFechaCreacion.Text = "Fecha de Creacion";
this.colFechaCreacion.Width = 107;
//
// frmServidores
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(631, 445);
this.Controls.Add(this.lsvBBDD);
this.Controls.Add(this.btnListarBBDD);
this.Controls.Add(this.TxtContrasenha);
this.Controls.Add(this.txtUsuario);
this.Controls.Add(this.lblContrasenha);
this.Controls.Add(this.lblUsuario);
this.Controls.Add(this.txtServidor);
this.Controls.Add(this.lblServidor);
this.Controls.Add(this.btnListarServidores);
this.Controls.Add(this.lsvServidores);
this.Name = "frmServidores";
this.Text = "Servidores";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListView lsvServidores;
private System.Windows.Forms.Button btnListarServidores;
private System.Windows.Forms.ColumnHeader colNombreServidor;
private System.Windows.Forms.ColumnHeader colInstancia;
private System.Windows.Forms.ColumnHeader colVersion;
private System.Windows.Forms.Label lblServidor;
private System.Windows.Forms.TextBox txtServidor;
private System.Windows.Forms.Label lblUsuario;
private System.Windows.Forms.Label lblContrasenha;
private System.Windows.Forms.TextBox txtUsuario;
private System.Windows.Forms.TextBox TxtContrasenha;
private System.Windows.Forms.Button btnListarBBDD;
private System.Windows.Forms.ListView lsvBBDD;
private System.Windows.Forms.ColumnHeader colDBName;
private System.Windows.Forms.ColumnHeader colFechaCreacion;
}
}

View File

@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace ServerExplorer
{
public partial class frmServidores : Form
{
public frmServidores()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btnListarServidores_Click(object sender, EventArgs e)
{
// Obtener listado de servidores
SqlDataSourceEnumerator enumerador = SqlDataSourceEnumerator.Instance;
DataTable servidores = enumerador.GetDataSources();
lsvServidores.Items.Clear();
lsvBBDD.Items.Clear();
foreach (DataRow dr in servidores.Rows)
{
// Nombre del servidor
ListViewItem item = lsvServidores.Items.Add((String)dr["ServerName"]);
// Nombre de la instancia
if (dr["InstanceName"] == System.DBNull.Value)
{
item.SubItems.Add("");
}
else
{
item.SubItems.Add((String)dr["InstanceName"]);
}
// Numero de version
if (dr["Version"] == System.DBNull.Value)
{
item.SubItems.Add("???");
}
else
{
item.SubItems.Add((String)dr["Version"]);
}
}
}
private void lsvServidores_SelectedIndexChanged(object sender, EventArgs e)
{
if (lsvServidores.SelectedItems.Count > 0)
{
ListViewItem item = lsvServidores.SelectedItems[0];
if (item.SubItems[1].Text.CompareTo("")==0)
{
// Servidor sin subinstancias
txtServidor.Text = item.SubItems[0].Text;
}
else
{
// Servidor con subinstancias
txtServidor.Text = item.SubItems[0].Text+"/"+item.SubItems[1].Text;
}
}
}
private void btnListarBBDD_Click(object sender, EventArgs e)
{
// Construir cadena de conexion
SqlConnectionStringBuilder constructor = new SqlConnectionStringBuilder();
constructor.DataSource = txtServidor.Text;
constructor.InitialCatalog = "master";
constructor.UserID = txtUsuario.Text;
constructor.Password = TxtContrasenha.Text;
// Obtener todas las bases de datos
SqlConnection cnx = new SqlConnection(constructor.ConnectionString);
cnx.Open();
DataTable dt = cnx.GetSchema("Databases");
cnx.Close();
// Mostrar bases de datos
lsvBBDD.Items.Clear();
foreach (DataRow dr in dt.Rows)
{
ListViewItem item = lsvBBDD.Items.Add((String)dr["database_name"]);
item.SubItems.Add(((DateTime)dr["create_date"]).ToShortDateString());
}
}
private void lsvBBDD_DoubleClick(object sender, EventArgs e)
{
if (lsvBBDD.SelectedItems.Count == 1)
{
// Construir cadena de conexion final
SqlConnectionStringBuilder constructor = new SqlConnectionStringBuilder();
constructor.DataSource = txtServidor.Text;
constructor.InitialCatalog = (String)lsvBBDD.SelectedItems[0].SubItems[0].Text;
constructor.UserID = txtUsuario.Text;
constructor.Password = TxtContrasenha.Text;
// Llamar a la venta de la base de datos
frmBaseDatos frm = new frmBaseDatos(constructor.ConnectionString);
frm.Show();
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>