DonWolli
|
Posted: 09/01/2003, 9:55 PM |
|
how can i realise a join of two tables in two different databases with CCS 2.1.20?
|
|
|
RonB
|
Posted: 09/02/2003, 12:54 AM |
|
use the beforeshow row event to get the value from the second database with CCGetDBValue using the label holding the key for the second database in the query. For example:
global $gridname;
$db = new clsDBConnection2();
$gridname->db2_field->setvalue(CCGetDBValue("select field_in_db2 from db2_table where key_field_db2 =" .$gridname->db1_field->GetValue(), $db);
unset($db);
Ron
|
|
|
DonWolli
|
Posted: 09/02/2003, 1:12 AM |
|
thanks ,
the problem standing behind is a little bit more complex nevertheless its an "allday" day problem.
i have two tables customer and orders.
in the order_maint form i have a list box with an sql-command which shows the list of all customers. as bound column i use the customer-id , as text-column name+id.
now i have second column,called "plz" of the customertable which i want to store in the order table column "plz" after selection of the customer-id.
my problem:
how can i use customer.plz to set order.plz ???
probably a lack of CCS-knowledge on my side ....
wolfgang
|
|
|
RonB
|
Posted: 09/02/2003, 1:43 AM |
|
Ok,
in that case use the before insert event :
as the value of the plz field in the order form is dependent of the customer selected in the dropdown it's no use in showing it on the grid, so make it a hidden field.
global $gridname;
$db=new clsDBConnection2();
$gridname->hidden_plz_field_name->setvalue(CCGetDBValue("select plz from customer_table where customer_id=" .$gridname->listbox_field->GetValue() ,$db);
unset($db);
Ron
|
|
|
DonWolli
|
Posted: 09/02/2003, 2:20 AM |
|
hi ronB, thanks a lot for your help.
after finally inserting a second ")" at the end of the line , it worked ())) )
as i said : a problem of not-knowing the ccs-functions ...
again
thanks a lot
wolfgang
|
|
|
|