Solved

Printing out sql query on screen

Posted on 2006-11-01
5
2,415 Views
Last Modified: 2011-04-14
I would like to be able to see my sql querys on screen (or in any other way) when debugging.

In classing asp I could just print out the query with it's values like

sql = "Select * from table where id = " & request("id")
set rs = conn.execute(sql)
response.write(sql)

then I could see what values where in the query.

How can I get a similar result in asp.net?
0
Comment
Question by:peternordberg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17850385
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sql As String
        Sql = "Select * from table where id = " & Request("id")
        Response.Write(Sql)
    End Sub
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17851593
You can also use System.Diagnostics.Debug.WriteLine to set it in the Output window.

Bob
0
 

Author Comment

by:peternordberg
ID: 17852204
How do I do that?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17854902
Dim commandText As String = "Select * From Users Where Name = 'Bob' "
System.Diagnostics.Debug.WriteLine(commandText)

Bob
0
 

Author Comment

by:peternordberg
ID: 17856188
ok, I'll try
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question