Ashx SQL Debug - How to?

Hello all,

I’m going nuts with an error, because I don’t know which params are going to the sql query.

Is there a way to the ashx show me what is exactly executing in the query?


<%@ WebHandler Language="C#" Class="gridContasContabeis" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using dhtmlxConnectors;
using System.Configuration;
using System.Web.SessionState;

public class dridContasContabeis : dhtmlxRequestHandler, IRequiresSessionState
{

    
    public override IdhtmlxConnector CreateConnector(HttpContext context)
    {
        String cdEmpresa = (context.Request.QueryString["cdEmpresa"] == null) ? "0" : context.Request.QueryString["cdEmpresa"].ToString();
        context.Session["cd_empresa"] = (context.Session["cd_empresa"] == null) ? cdEmpresa : context.Session["cd_empresa"];

        String cdUser = (context.Request.QueryString["cdUser"] == null) ? "0" : context.Request.QueryString["cdUser"].ToString();
        context.Session["cd_user"] = (context.Session["cd_user"] == null) ? cdUser : context.Session["cd_user"];
        
        String cd_caso = (context.Request.QueryString["cd_caso"] == null) ? "0" : context.Request.QueryString["cd_caso"].ToString();

            String sqlCon = "Select "+
                                "CD_Caso, "+ //1
                                "CD_Centro_Custo_Pagamento, "+ //2
                                "DS_Conta_Contabil, "+ //3
                                "CD_Conta_Contabil, "+ //4
                                "DT_Prazo, "+ //5
                                "VL_Prazo, "+ //6
                                "DS_Observacao, "+ // 7
                                "CD_Usuario_Cadastro, "+ //8
                                "CD_Status, "+ //9
                                "DT_Operacao "+ //10
                            "FROM gridCasosContasContabeis WHERE cd_caso = " + cd_caso;

        dhtmlxGridConnector connector = new dhtmlxGridConnector(sqlCon, "CD_Caso_ContaContabil",
        dhtmlxDatabaseAdapterType.SqlServer2005, ConfigurationManager.AppSettings["ConnectionStringEstrutura"]);

         sqlCon = "[dbo].[Proc_CasosContabeis]  "+
                                " @opcao = 'insert' "+
                                ",@CD_Caso ={CD_Caso} "+
                                ",@CD_Conta_Contabil = {CD_Conta_Contabil}  "+
                                ",@DT_Prazo = '{DT_Prazo}'  "+
                                ",@VL_Prazo = '{VL_Prazo}'  "+
                                ",@DS_Observacao = '{DS_Observacao}'  "+
                                ",@CD_Usuario_Cadastro = {CD_Usuario_Cadastro} ";

        connector.Request.CustomSQLs.Add(CustomSQLType.Insert, sqlCon);

            sqlCon = "[dbo].[Proc_CasosContabeis]  "+
                                " @opcao = 'update' "+
                                ",@CD_Caso_ContaContabil ={CD_Caso_ContaContabil} "+
                                ",@CD_Caso ={CD_Caso} "+
                                ",@CD_Conta_Contabil = {CD_CONTA_CONTABIL}  "+
                                ",@DT_Prazo = '{DT_Prazo}'  "+
                                ",@VL_Prazo = '{VL_Prazo}'  "+
                                ",@DS_Observacao = '{DS_Observacao}'  "+
                                ",@CD_Usuario_Cadastro = {CD_Usuario_Cadastro} ";

        connector.Request.CustomSQLs.Add(CustomSQLType.Update, sqlCon);

            sqlCon = "[dbo].[Proc_CasosContabeis] "+
                            " @opcao = 'detele' "+
                            ",@CD_Caso_ContaContabil={CD_Caso_ContaContabil} "+
                            ",@CD_Usuario_Cadastro =" + context.Session["cd_user"] + "";

        connector.Request.CustomSQLs.Add(CustomSQLType.Delete, sqlCon);


        connector.BeforeOutput += new EventHandler<RenderEventArgs>(connector_BeforeOutput);
        return connector;
    }
    
    void connector_BeforeOutput(object sender, RenderEventArgs e)
    {
        if (this.Connector.Request.StartIndex == 0)
        {
            e.Writer.WriteStartElement("head");
            {

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("CD_Caso");
                }
                e.Writer.WriteEndElement();
                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("CD_Centro_Custo_Pagamento");
                }
                e.Writer.WriteEndElement();
                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "232");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("Conta Contabil");
                }
                e.Writer.WriteEndElement();
                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("CD_Conta_Contabil");
                }
                e.Writer.WriteEndElement();
                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "82");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("Data Prazo");
                }
                e.Writer.WriteEndElement();

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "82");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("Valor Prazo");
                }
                e.Writer.WriteEndElement();

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "*");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("Observação");
                }
                e.Writer.WriteEndElement();

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("CD_Usuario_Cadastro");
                }
                e.Writer.WriteEndElement();

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("CD_Status");
                }
                e.Writer.WriteEndElement();         
                

                e.Writer.WriteStartElement("column");
                {
                    e.Writer.WriteAttributeString("width", "0");
                    e.Writer.WriteAttributeString("type", "ro");
                    e.Writer.WriteAttributeString("align", "left");
                    e.Writer.WriteAttributeString("sort", "str");
                    e.Writer.WriteString("DT_Operacao");
                }
                e.Writer.WriteEndElement();                          
                                                                
                e.Writer.WriteStartElement("settings");
                {
                    e.Writer.WriteStartElement("colwidth");
                    {
                        e.Writer.WriteString("px");
                    }
                    e.Writer.WriteEndElement();
                }
                e.Writer.WriteEndElement();
            }
            e.Writer.WriteEndElement();
        }
    }
    
}

returns that I’m trying to insert a varchar on a int column.

How do I see which is this value?