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 -> .NET

 Problem with Dynamic Where statment

Print topic Send  topic

Author Message
zolw


Posts: 51
Posted: 05/13/2005, 8:13 PM

Hi all,

I have a page called Search_page.aspx.
In this page I have one grid and a search form.
The classic "s_keyword" field is sending the words I will be looking for in the grid.
I need to build my own WHERE statment and it is a little complex code to do what I need, but I did it and got the code ready.

The problem is:
In the "'Page Event BeforeShow." that is stored into the "Search_page.aspx.vb" I am getting the Request.QueryStrinng.Item and doing all the code I need to form the WHERE and all is ready now.

But I cant find a way to pass the WHERE code or variable to the "BeforeExecuteSelect." that is stored in the "Search_pageDataProvider.vb".

I just need to pass the variable, a session variable or something to have the WHERE statment in the page "Search_pageDataProvider.vb" and into "BeforeExecuteSelect" to add my own WHERE using:
"DirectCast(Select_,TableCommand).Where = XXXXXXXX

I cant pass the data there.

Any hint?

Thanks,

Carlos:(
_________________
Zolw
http://www.xlso.com
View profile  Send private message
zolw


Posts: 51
Posted: 05/13/2005, 9:32 PM

I got it now.

It was an error in my coding. I had to change something and place all the code in the "BeforeBuildSelect".

But now I have another problem with the same page.

After buiding and inserting my own WHERE code I get the results right but the page navigator and the total records label keep showing like if there was not a WHERE statment added and shows all the pages for all the records in the table and the record label shows a count of all the records in the table.
Also I added a code to hide the grid if there are not results but even if there are no records to show the grid still visible.

Any help with that?

Thanks,

_________________
Zolw
http://www.xlso.com
View profile  Send private message
peterr


Posts: 5971
Posted: 05/13/2005, 10:41 PM

Try this code in Before Build Select:
Count.SqlQuery = New StringBuilder("SELECT COUNT(*) FROM (" + Select_.SqlQuery.ToString() + ") cnt")

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
zolw


Posts: 51
Posted: 05/13/2005, 10:51 PM

peterr:

Thanks for your answer but the line is inserted now and is not helping.
Any other idea?

_________________
Zolw
http://www.xlso.com
View profile  Send private message
zolw


Posts: 51
Posted: 05/13/2005, 11:22 PM

peterr:

Thanks again, I had to do a small modification from your code but now it works.

The final line is like this:
Count.SqlQuery = New StringBuilder("SELECT COUNT(*) FROM (" + Select_.ToString() + ") cnt")

I just had to remove the "SqlQuery" between "Select_" and "ToString()"

Regards,
_________________
Zolw
http://www.xlso.com
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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