Refactorings
This commit is contained in:
@@ -1,11 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using ServerExplorer.Code.DataTransfer;
|
||||
|
||||
namespace ServerExplorer.Code.DataAccess
|
||||
{
|
||||
class TableDA
|
||||
public class TableDA
|
||||
{
|
||||
public static List<Table> Table_GetRegs(string conexionString)
|
||||
{
|
||||
var tables = new List<Table>();
|
||||
var cnx = new SqlConnection(conexionString);
|
||||
|
||||
cnx.Open();
|
||||
DataTable dt = cnx.GetSchema("Tables");
|
||||
cnx.Close();
|
||||
dt.DefaultView.Sort = "TABLE_SCHEMA ASC, TABLE_NAME ASC, TABLE_TYPE ASC";
|
||||
dt = dt.DefaultView.ToTable();
|
||||
|
||||
// Mostrar todas las tablas
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
tables.Add(new Table
|
||||
{
|
||||
Schema = (string)dr["TABLE_SCHEMA"],
|
||||
Name = (string)dr["TABLE_NAME"],
|
||||
Type = (string)dr["TABLE_TYPE"]
|
||||
});
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user