Solved

Printing out sql query on screen

Posted on 2006-11-01
5
2,412 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
crm development 2 64
javascript window.createPopup() not working in chrome but works in IE browser 3 98
asp.net mvc return json 2 53
Host asp.net pages 5 25
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now