Solved

Printing out sql query on screen

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

22 Experts available now in Live!

Get 1:1 Help Now