changing alias in run-time..no effect ? 
Author Message
 changing alias in run-time..no effect ?

hi,

i'm using the following code in my program :

 // design-time initialization
  MyTable.tablename := 'table.db';
  MyTable.database := TheAlias;

// a snip of code somwhere in the application
  NewPath := SomethingElse;
  MyTable.close;
  DeleteAlias(TheAlias);
  AddStandardAlias(TheAlias,NewPath,'PARADOX');
  MyTable.open;

Sometimes the table shows the data from the new path, but most of the time
it acts like it has never noticed the change of path.

i've been trying the session.dropconnections method and
session.keepconnections property, but again, sometimes it works, but most
of the time, no luck.

is there some method i'm missing to beat some sense into a table ?

thanks in advance,

Jeroen


*************************************
J.M.Stolting
Freudenthal institute
Utrecht, The Netherlands



Mon, 17 May 1999 03:00:00 GMT
 changing alias in run-time..no effect ?

Quote:

> hi,

> i'm using the following code in my program :

>  // design-time initialization
>   MyTable.tablename := 'table.db';
>   MyTable.database := TheAlias;

> // a snip of code somwhere in the application
>   NewPath := SomethingElse;
>   MyTable.close;
>   DeleteAlias(TheAlias);
>   AddStandardAlias(TheAlias,NewPath,'PARADOX');
>   MyTable.open;

> Sometimes the table shows the data from the new path, but most of the time
> it acts like it has never noticed the change of path.

> i've been trying the session.dropconnections method and
> session.keepconnections property, but again, sometimes it works, but most
> of the time, no luck.

> is there some method i'm missing to beat some sense into a table ?

> thanks in advance,

> Jeroen


> *************************************
> J.M.Stolting
> Freudenthal institute
> Utrecht, The Netherlands


Jeroen,

Adjusting Alias information can only be done before the BDE is
activated, so no Data aware components may be created. If you would like
to create a Alias name at runtime make sure that you no form before the
one adjusting alias settings uses any data aware components. Adjust the
settings and start the BDE from the program.
The best way to do so is to start the procedure that creats an alias
from within the initialization. For example:

Initialization
begin
{Initialize the BDE}
Check(DbiInit(nil));
try
 {Open get a handle to the alias list}
 Check(DbiOpenDatabaseList(TmpCursor));
 AliasFound := False;
  repeat
    {Get a DBDesc record for the next alias}

    if (rslt <> DBIERR_EOF) then
      if StrPas(Database.szName) = 'DWTAlias' then
        begin
          {The alias DWTAlias already exists}
          AliasFound := True;
          Break
        end;
  until rslt <> DBIERR_NONE;
  {Release the handler}
  Check(DbiCloseCursor(TmpCursor));
  if not AliasFound then
    {If the alias was not found, add it to IDAPI.CFG}
    Check(DbiAddAlias(nil,PChar('DWTAlias'),nil,
       PChar('PATH:'+ExtractFilePath(Application.ExeName)),True))
finally
  DbiExit;
end;
end;

Good luck,

Michael Faisst


Faisst IT-Consultancy
postbus 90173
1006 BD  Amsterdam



Wed, 19 May 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Changing the location of alias at run-time

2. Changing/adding DB-Aliases run-time

3. Change path of BDE-alias at run-time

4. Change BDE alias in run-time ?

5. Changing an alias at run-time

6. Change BDE alias in run-time ?

7. Add an alias at run-time

8. Adding alias to BDE at run time

9. aliases path at run time

10. Creating alias & ODBC Driver in Run-Time

11. Microsoft Visual C++ Run time library Run time error R6025

12. Converting v3.5DOS Run-Time to v4.5w or v5.0w standard or Run-Time


 
Powered by phpBB® Forum Software