?
Solved

Printing out sql query on screen

Posted on 2006-11-01
5
Medium Priority
?
2,417 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 750 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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