outputting sql

Results 1 to 2 of 2

Thread: outputting sql

  1. #1
    Join Date
    Dec 1969

    Default outputting sql

    Hi,<BR><BR>Is there any way of outputting the sql command like I used to in classic asp (response.write(SQL) - where SQL is the SQL command variable)? Or use some sort of SQL debug facility?<BR><BR>Here is my .NET code<BR><BR>con = New SqlConnection "Server=sqlserver;UID=me;PWD=pwd;Database=db")<BR> SQL = New SqlCommand("SELECT * FROM table WHERE id = @id", con)<BR>SQL.Parameters.Add("@id", 3)<BR>con.Open()<BR>datareader = SQL.ExecuteReader()<BR><BR>I would like the response.write output to be: SELECT * FROM table WHERE id = 3<BR><BR>Anyone?<BR><BR>Cheers<BR><BR>Dave <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: outputting sql

    try: response.write(SQL.commandText)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts