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 change datasource for page controls

Print topic Send  topic

Author Message
JerryVT
Posted: 03/04/2004, 11:32 PM

Hi,
I have tables for each month and I want to display data from them on the same asp page depending on the value in query string - info.asp?m=May

How can I dynamically change datasource for all controls on this page?

Thanks
DonB
Posted: 03/05/2004, 5:20 AM

In the Data Source properties, include one more "Where" item. On the
righthand side of the "=" put in "'" + CCGetParam("m","") "'" and make the
type "Expression". I added apostrophes because the parameter is a string.
Change the 2nd parameter of CCGetParam to something else if you want a
default value.

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:640482d0c7cf57@news.codecharge.com...
> Hi,
> I have tables for each month and I want to display data from them on the
same asp page depending on the value in query string - info.asp?m=May
>
> How can I dynamically change datasource for all controls on this page?
>
> Thanks
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

JerryVT
Posted: 03/05/2004, 9:12 AM

Hi Don,

I wanted to know if it is possible to change table name (after "FROM"):
SELECT * FROM March

Also, I have 4 listboxes on this page showing Distinct values with SQL:
SELECT DISTINCT Shipped FROM March

Is it possible to change table names dynamically?

If not, I guess we'll need to create a query to select data from all tables an use WHERE as you have suggested...

Thank you for your great help!
DonB
Posted: 03/05/2004, 1:21 PM

Should be possible - the SQL property of the datasource is exposed as a
public property. It raises a whole bunch of issues with databinding to any
controls on the page. If you are only altering the data source that fills a
listbox with choices, then it should be fine to change the table although
you probably should establish a pair of aliases (for the bound column and
the text column) so these never change.

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:64048b50970bae@news.codecharge.com...
> Hi Don,
>
> I wanted to know if it is possible to change table name (after "FROM"):
> SELECT * FROM March
>
> Also, I have 4 listboxes on this page showing Distinct values with SQL:
> SELECT DISTINCT Shipped FROM March
>
> Is it possible to change table names dynamically?
>
> If not, I guess we'll need to create a query to select data from all
tables an use WHERE as you have suggested...
>
> Thank you for your great help!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

JerryVT
Posted: 03/05/2004, 4:40 PM

OK I moved all data in one table & I "kinda" made it work - now if user clicks on the link "April" -> ( file.asp?m=April ) the next page displays only April records but on the same page there is a Search form and I don't know how to pass the name of the month each time user clicks on this Search button.

Normally, i'd put it into Sesion var or pass it through Search form's hidden field and check for it each time this page is reloaded...

Where do I see the parameters that this Search form is submiting anyway?
JerryVT
Posted: 03/05/2004, 4:58 PM

More about search form.
Where can I change GET & POST?
I inserted a new text field into search form but I couldn't find the way to make this form submitting parameters form this field.

Any suggesions? I've tried looking through 500 pages PDF manual.
Is it there?
DonB
Posted: 03/05/2004, 5:29 PM

The parameter-handling in CCS is very straightforward. If a field is not
bound to a data source, and there is a query parameter with the same name as
the control, CCS will automatically load it into the control. On your link
to the search form, either the ?m= needs to change to match the name of the
corresponding search field, or you rename the search field to "m".

The "companion" form (a grid or whatever) has it's datasource set up with a
Where parameter to match the search form. You should make the naming
consistent throughout and then it ought to work.
--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:640492240d74a4@news.codecharge.com...
> More about search form.
> Where can I change GET & POST?
> I inserted a new text field into search form but I couldn't find the way
to make this form submitting parameters form this field.
>
> Any suggesions? I've tried looking through 500 pages PDF manual.
> Is it there?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

JerryVT
Posted: 03/05/2004, 6:13 PM

Don,
I have renamed everything as you've suggested.

I have inserted hidden field s_Month into a search form.
But when this form is submitted the string:
file.asp?s_Month=&
is empty and I'm still getting wrong records.


Also, I was looking how to change form's method from GET to POST


DonB
Posted: 03/05/2004, 7:01 PM

I think maybe you need to start fresh with a builder-created search form
(minus the table-switching mods) and compare the search parameter passing
you have developed vs. the standard search form that CCS builds. You've
overlooked something because it will work if the names match .

On the get vs. post - you edit the <form> tag... but they are post already
(or should be since that's what CCS generates by default). Parameters are
fetched from post or get depending on whether the for is submitted or not
(respectively). If you are trying to hide the parameter I don't know what
to tell you - it might work or it might not.

--
DonB

http://www.gotodon.com/ccbth


"JerryVT" <JerryVT@forum.codecharge> wrote in message
news:6404933b8c8c7d@news.codecharge.com...
> Don,
> I have renamed everything as you've suggested.
>
> I have inserted hidden field s_Month into a search form.
> But when this form is submitted the string:
> file.asp?s_Month=&
> is empty and I'm still getting wrong records.
>
>
> Also, I was looking how to change form's method from GET to POST
>
>
>
> ---------------------------------------
> 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.