how to debug SQL-statements?

Discussion in 'ASP .Net Web Controls' started by Janne Lepola, Aug 23, 2007.

  1. Janne Lepola

    Janne Lepola Guest

    Hi,

    I recently changed developing from ASP to ASP.NET and I'm having
    problems with accessing SQL-statements built by FormView. For some
    reason FormView update-statement doesn't work in some cases (but neither
    raises error), so I though I'd like to get response of update-statement
    which was sent to SQL-server. I tried using follwing code:

    Protected Sub SqlDataSource1_Updating(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles
    SqlDataSource1.Updating

    resultLabel.Text = ""
    resultlabel.Text = SqlDataSource1.UpdateCommand

    End Sub

    unfortunately this code seems to echo only preformatted SQL-update
    statement without parameters. Basically update looks like "UPDATE
    Something SET SomethingElse = :SomethingElse", while I'm looking for
    "UPDATE Something Set SomethingElse = 'user inputted this string, hello
    world!'".

    How can I access this final SQL-statement?

    - Janne Lepola , Finland
     
    Janne Lepola, Aug 23, 2007
    #1
    1. Advertising

  2. Janne Lepola

    Janne Lepola Guest

    Janne Lepola wrote:
    > Hi,
    >
    > I recently changed developing from ASP to ASP.NET and I'm having
    > problems with accessing SQL-statements built by FormView. For some
    > reason FormView update-statement doesn't work in some cases (but neither
    > raises error), so I though I'd like to get response of update-statement
    > which was sent to SQL-server. I tried using follwing code:
    >
    > Protected Sub SqlDataSource1_Updating(ByVal sender As Object, ByVal e As
    > System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles
    > SqlDataSource1.Updating
    >
    > resultLabel.Text = ""
    > resultlabel.Text = SqlDataSource1.UpdateCommand
    >
    > End Sub
    >
    > unfortunately this code seems to echo only preformatted SQL-update
    > statement without parameters. Basically update looks like "UPDATE
    > Something SET SomethingElse = :SomethingElse", while I'm looking for
    > "UPDATE Something Set SomethingElse = 'user inputted this string, hello
    > world!'".
    >
    > How can I access this final SQL-statement?
    >
    > - Janne Lepola , Finland


    I'm working with Oracle database, so I cannot use SQL Server -debugging
    options as such. Isn't there any way to access compiled statement
    through SqlDataSource or FormView -component?

    - Janne Lepola
     
    Janne Lepola, Aug 23, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella
    Replies:
    8
    Views:
    1,208
    mfmehdi
    Oct 20, 2006
  2. Harry George
    Replies:
    6
    Views:
    417
    Bart Nessux
    Feb 23, 2004
  3. Vince
    Replies:
    12
    Views:
    761
    Martin Gregorie
    Jan 21, 2008
  4. JT
    Replies:
    1
    Views:
    124
    Bob Barrows [MVP]
    Sep 27, 2005
  5. John Crichton
    Replies:
    6
    Views:
    270
    John Crichton
    Jul 12, 2010
Loading...

Share This Page