CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Help with debugging ASP

Print topic Send  topic

Author Message
cringwall

Posts: 11
Posted: 03/04/2009, 2:32 PM

I have a search and grid form on my page and I'm getting an error when I execute a search:

Error: Incorrect syntax near the keyword 'WHERE'. (Microsoft OLE DB Provider for SQL Server)



What is the best way to output the actual SQL statement the script is getting to the browser in ASP? I'm sure if I could actually see the SQL, the error would be apparent.

Any help would be appreciated!

Carl
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 03/04/2009, 10:32 PM

somewhere on your page (outside the grid and search panel) add three Labels (Label1, Label2 and Label3).

in design view click your grid to select it

in the Properties panel select Data and note the Name property of your grid

in the Properties panel select Events

right-click Before Execute Select and choose Add Code...

in the code window, under the line marked ' Write your own code here, add the following,

Label1.Text = "YOUR-GRID-NAME-HERE.DataSource.SQL: " & Contacts.DataSource.SQL
Label2.Text = "YOUR-GRID-NAME-HERE.DataSource.Where: " & Contacts.DataSource.Where
Label3.Text = "YOUR-GRID-NAME-HERE.DataSource.Order: " & Contacts.DataSource.Order

now test your code. this may not help while the error is there though because it probably has to run successfuly for this to work. but you can try simplifying your SQL and adding back in some of the code until it breaks and watch this whenever it works.
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 03/04/2009, 10:34 PM

something else you might want to try

in design mode click your grid to select it

in the Properties panel select Data, click Data Source and then click the ...

in the Visual Query Builder you can click the SQL button in the top bar to see the SQL statement
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
cringwall

Posts: 11
Posted: 03/05/2009, 6:23 AM

Great ideas, I'll try them both today and let you know what happens.


Well, I was able to get my sql, and I put it into Query Analyzer and it worked perfectly!

I ended up trashing the page and did a simpler query and now I'm back on track. Thanks for the help.

Carl
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 03/05/2009, 8:50 AM

you're welcome! I have found that sometimes it is faster to just dump a page and recreate it.
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.