CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> ASP

 Dynamically Altering Where Clause

Print topic Send  topic

Author Message
NewbieRob

Posts: 20
Posted: 09/13/2005, 5:19 PM

Using ASP VBScript I have BeforeBuildSelect code which builds a Where clause for SQL based on what's in the s_keyword field of the search box for the grid. I parse s_keyword and insert OR between words. It appears that it is building the string correctly but when I use the syntax indicated in the help system to modify the SQL Where in CCS it just puts my string in front of "AND [Search Description] like '%search words here%'" instead of replacing the Where clause completely with my string, which of course produces a syntax error.

The code I am using to replace Where is:

q_WaterQuery.DataSource.Where = q_WaterQuery.DataSource.Where & sWhr

How can I replace Where with my string instead of just placing my string in front of what CCS creates for Where from s_keyword? I feel like I've almost got it but am missing one small step to finishing it up. This is a very important project so any tips will be a tremendous help.

(also posted in General/other)
View profile  Send private message
DonB
Posted: 09/13/2005, 9:00 PM

I code that sort of thing in the BeforeSelect, not BeforeBuildSelect. Move
to the other event and see how that works. Never seen the behavior you
describe, but it suggests that your 'where' string is assigned when the
Where property is empty - and later in the execution the "AND [Search
Description]..." gets loaded (presumably that's coming from a design-time
Where property in the Data Source) and appended to your string.

The BeforeSelect occurs in the context of the Grid whereas the
BeforeBuildSelect occurs in the context of the Data Source. By context, I
mean look at the Function declarations of the events - see the grid appears
in one, and the data source only apepars in the other?

So, in short, it's a matter of when the events fire off, and what's in the
Where property at those moments, which is throwing you off.

--
DonB

http://www.gotodon.com/ccbth


"NewbieRob" <NewbieRob@forum.codecharge> wrote in message
news:643276c7914a19@news.codecharge.com...
> Using ASP VBScript I have BeforeBuildSelect code which builds a Where
clause for
> SQL based on what's in the s_keyword field of the search box for the grid.
I
> parse s_keyword and insert OR between words. It appears that it is
building the
> string correctly but when I use the syntax indicated in the help system to
> modify the SQL Where in CCS it just puts my string in front of "AND
[Search
> Description] like '%search words here%'" instead of replacing the Where
clause
> completely with my string, which of course produces a syntax error.
>
> The code I am using to replace Where is:
>
> q_WaterQuery.DataSource.Where = q_WaterQuery.DataSource.Where & sWhr
>
> How can I replace Where with my string instead of just placing my string
in
> front of what CCS creates for Where from s_keyword? I feel like I've
almost got
> it but am missing one small step to finishing it up. This is a very
important
> project so any tips will be a tremendous help.
>
> (also posted in General/other)
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


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.