Cambiar modo en el que se obtiene el texto de las rutinas, para que obtenga mas que los primeros 4000 caracteres

This commit is contained in:
2014-09-08 16:53:07 +02:00
parent 24a62569b7
commit 00b1da5da7

View File

@@ -1,14 +1,7 @@
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.Collections;
using System.Windows.Forms;
namespace ServerExplorer.UI
{
@@ -16,7 +9,6 @@ namespace ServerExplorer.UI
{
#region Declarations
private string cnxString;
private SqlConnection cnx;
#endregion
@@ -27,7 +19,6 @@ namespace ServerExplorer.UI
{
InitializeComponent();
this.cnxString = cnxString;
cnx = new SqlConnection(cnxString);
}
@@ -86,12 +77,21 @@ namespace ServerExplorer.UI
private void LoadProcedure(string schema, string name)
{
DataTable dt;
SqlDataAdapter da;
da = new SqlDataAdapter("SELECT ROUTINE_DEFINITION from INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME=@Name AND ROUTINE_SCHEMA=@Schema", cnx);
var da = new SqlDataAdapter(@"
SELECT
ISNULL(smsp.definition, ssmsp.definition) AS [Definition]
FROM sys.all_objects AS sp
LEFT OUTER JOIN sys.sql_modules AS smsp ON smsp.object_id = sp.object_id
LEFT OUTER JOIN sys.system_sql_modules AS ssmsp ON ssmsp.object_id = sp.object_id
WHERE
(sp.type = N'P' OR sp.type = N'RF' OR sp.type='PC')
and
(sp.name=@name and SCHEMA_NAME(sp.schema_id)=@schema)
", cnx);
da.SelectCommand.Parameters.AddWithValue("@Name", name);
da.SelectCommand.Parameters.AddWithValue("@Schema", schema);
dt = new DataTable();
var dt = new DataTable();
cnx.Open();
da.Fill(dt);
cnx.Close();