[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Change Company Programmatical

gunnark

11/15/2005 4:48:00 PM

Hi,

i connected an external application with the com connector. Now i need to
change, while the conntion is running, the comany.
So is it possible to change the company programmatical, or do i have to
reconnect ?

thx gunnar
1 Answer

Anton Venter

11/15/2005 9:08:00 PM

0

From the developer's guide:

Working with more than one company.

Large companies are often split up into several legal entities. MorphX
supports this by using the changecompany function in X++.

changecompany
The change company statement is used to alter the database settings to
another (separate) company. The syntax of the statement is:

Changecompany = changecompany ( expression ) Statement

The expression is a string expression, which defines which company is to be
used. The statement is executed on the new company. The example below shows
how to use this statement:

static void main()
{
custtable Custtable;
// Assume that we are running in company 'aaa'

changeCompany('bbb')
{
// default company is now 'bbb'
Custtable = NULL;

while select Custtable
{
// Custtable is now selected in company 'aaa'
}
}

// default company is now set back to 'aaa' again
changeCompany('ccc')
{
// default company is now 'ccc'
Custtable = NULL;

// clear Custtable to let the select work on the new default company
while select Custtable
{
// Custtable is now selected in company 'ccc'
}
}

// default company is now 'aaa' again
}


"gunnark" <gunnark@discussions.microsoft.com> wrote in message
news:686E0810-FA68-4D33-A175-AC8FCBFF475F@microsoft.com...
> Hi,
>
> i connected an external application with the com connector. Now i need to
> change, while the conntion is running, the comany.
> So is it possible to change the company programmatical, or do i have to
> reconnect ?
>
> thx gunnar