Home Server

Changing MySql Databases with Custom Parameters

edited March 2003 in Server
I am trying to change the MySql database using session variables. I have
successfully passed the variables from the webtier to the rsServer in the
Validate Sessions section. From here I have some database components in a
TDatamodule that I need to change which database I'm working with. When I
do the following code the system gives a memory error on the web page.

datamodule1.ZMySqlDatabase1.Connected := False;
datamodule1.ZMySqlDatabase1.Database := SessionDataBaseValue;
datamodule1.ZMySqlDatabase1.Connected := True;
datamodule1.ZMySqlTable1.Active := True;

Because I'm using MySql I don't seem to be able to use DADE or RAP so all my
information is in the DataModule.

Any ideas would be greatly appreciated. Thanks,

Bill

Comments

  • edited March 2003
    Sorry about the post. I figured it out.

    I set a global variable (g_database) to SessionDataBaseValue.
    I then went to my reports and in the ppReport1BeforePrint event I
    set ZMySqlDatabase1.Database := g_database; I didn't need
    to set the "connect/active" values to true since ReportBuilder Server did it
    for me.

    Thanks,

    Bill

This discussion has been closed.