Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Values Passed To A DataSource

Status
Not open for further replies.

MxWade

Programmer
Aug 17, 2009
11
0
0
US
Hello -

I would like to print the SQL query and the values that are being passed to a datasource.

I have used the following command and it shows the query but not the values:

Debug.Print("The SQL string = " + sdsFacilityList.SelectCommand.ToString())

This is the result that I get:

The SQL string = SELECT path, facility_name, document_date, title, division, branch, program, subprogram, project_managers, authors, category, object_name, cimid, combined FROM vw_derr_combined WHERE (branch LIKE @branch) AND (program LIKE @program) AND (subprogram LIKE @subprogram) AND (facility_name LIKE @facility_name) AND (combined LIKE '%' + @combined + '%')

Is there a way to show the query as it is being sent to the database with the values in it?

Thanks,
MxW
 
No, that is the problem with the datsource controls, and why Jason and I, in your previous posts, sugguested you stay away from the datasource controls.

If you stick with them, the only option I know of is using SQL Profiler if you are using sql server.
 
just notice what the actual sql statement is. this looks like a query produced by an open-ended search screen. if that's the case i would look into Lucene.Net. this is an indexing framework which is very effecient. I have seen it used in parallel with nhibernate with success. here are some links on lucene.net
Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks for the answers. Sometimes using a datasource and a gridview is an easy fast way to put together something that there is a need for. This little app is for viewing e-docs that are on an internal server.

I have been staying away from datasources for many of the projects that I work on but I like to leave all of my options open. The app works fine, and it went together fast which made my boss happy.

Not being able to look at the SQL query in the state that it is passed to the database is a pretty big obstacle. I wonder why MS did not provide for it.

Thanks again for your help, as you can probably tell I am new to ASP and your advise has been a big help.

MxW
 
Sometimes using a datasource and a gridview is an easy fast way to put together something that there is a need for.
you are exactly right. datasources are fast and easy. they are not extendable or flexible.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks - I just tried it and it works. This will be very useful.

MxW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top