Add an alias at run-time 
Author Message
 Add an alias at run-time
Hi all,

if i remember well, this question was alreay asked, but i didn't
noticed at that time.

i'd like to add a new alias at run-time, but i really don't know how
to do ; and i have no docs about the dbi Engine.

any help much appreciated !

thanks in advance

guillaume



Thu, 18 Jun 1998 03:00:00 GMT
 Add an alias at run-time

Quote:

>Hi all,
>if i remember well, this question was alreay asked, but i didn't
>noticed at that time.
>i'd like to add a new alias at run-time, but i really don't know how
>to do ; and i have no docs about the dbi Engine.
>any help much appreciated !
>thanks in advance
>guillaume

There is a alias component available that allows you to do just that
(even more, you can add, edit, and delete aliases). You shoud be able
to find it on just about any Delphi sight on the net. If you need a
URL just ask, but you can use yahoo and scan for Delphi too.


Thu, 18 Jun 1998 03:00:00 GMT
 Add an alias at run-time

Quote:
>>if i remember well, this question was alreay asked, but i didn't
>>noticed at that time.
>>i'd like to add a new alias at run-time, but i really don't know how
>>to do ; and i have no docs about the dbi Engine.
>>guillaume
>There is a alias component available that allows you to do just that
>(even more, you can add, edit, and delete aliases). You shoud be able
>to find it on just about any Delphi sight on the net. If you need a
>URL just ask, but you can use yahoo and scan for Delphi too.

Or you can simply do this with a TDataBase component and as many TTables as you please.

procedure TForm1.OnCreate;
begin
  {Create Database Alias}
  Database1.DatabaseName:= 'MyNewAlias';
  Database1.DriverName:= 'STANDARD';
  Database1.Params.Clear;
  Database1.Params.Add('PATH=' + DataBaseDir);

  {Activate the Tables}
  MyTable.DatabaseName:= 'MyNewAlias';
  MyTable.Active:= True;
end;
Brett Fleming



Thu, 18 Jun 1998 03:00:00 GMT
 Add an alias at run-time

Quote:

>Hi all,
>i'd like to add a new alias at run-time, but i really don't know how
>to do ; and i have no docs about the dbi Engine.

You could try a component called "AliasMan", I think it will do the trick.
Here's a snippet from the readme file:

Introduction

  This component provides BDE alias creation and editing capabilities.
  The primary use is for creating aliases during program installation
  or initialization.

  The AliasMan unit can be used directly or installed as a component.
  If the component is installed, you can manage aliases at design
  time by double clicking on the TAliasManager component.  If all you
  need to do is create aliases in your program, you can just add
  AliasMan to your Uses clause, and call the AddAlias or AddStdAlias
  procedures.

AliasMan is released as freeware and can be found on various sites on the Net (I
can't remember where I found it, get back to me if you can't find it yourself).
Good Luck!

-----------------------------------------------------
 Tomas Matuschek
 University of Vaxjo, Sweden
-----------------------------------------------------



Sun, 19 Jul 1998 03:00:00 GMT
 Add an alias at run-time
Hello!

I'm trying to figure out the active record number programmatically. I
have the impression that the BDE API function DbiGetSeqNo should do the
job. However, when I use the following (L is a longint):

     Result := DbiGetSeqNo(Table1.Handle,L);

the result is DBIERR_BOF ($2201), which means, according to the
dbiprocs.int file (yes, I don't have to source): 'Beginning of Virtual
table'. Could somebody explain me what's wrong (the table is open, and
working correctly, etc.)? Also, am I on the right track to get the
active record number?

BTW, has anybody bought the 'Borland Database Engine User's Guide'? Is
it any good?

Regards,

Jani

--
---------------------------------------------------------------------

Check out Help Editor 2.0 for Windows at:
ftp://ftp.mpoli.fi/metropoli/windows/utils/hlped20.zip

1996: Only four years to computer confusion!
What have you done to avoid it?
---------------------------------------------------------------------
---
 * SLMR 2.1a *



Tue, 28 Jul 1998 03:00:00 GMT
 Add an alias at run-time


Quote:
>I'm trying to figure out the active record number programmatically. I
>have the impression that the BDE API function DbiGetSeqNo should do the
>job. However, when I use the following (L is a longint):

>     Result := DbiGetSeqNo(Table1.Handle,L);

>the result is DBIERR_BOF ($2201), which means, according to the
>dbiprocs.int file (yes, I don't have to source): 'Beginning of Virtual
>table'. Could somebody explain me what's wrong (the table is open, and
>working correctly, etc.)? Also, am I on the right track to get the
>active record number?

Was the table empty or records? This alone will result in the error cited
when calling the BDE API function DbiGetSeqNo from a Delphi application.

I would suggest checking (in the application's code) for the presence of
any records. If there are no records, simply return zero for the record
number. For example, a function to call DbiGetSeqNo or return zero:

  function RecNo(InTable: TTable): LongInt;
  var
    rslt: DBIResult;
    Recs: LongInt;
  begin
    if InTable.RecordCount = 0 then
      RecNo := 0
    else begin
      rslt := DbiGetSeqNo(InTable.Handle, Recs);
      if not (rslt = DBIERR_NONE) then
        RecNo := -1
      else
        Recno := Recs;
    end;
  end;

Or:

  function RecNo(InTable: TTable): LongInt;
  var
    rslt: DBIResult;
    Recs: LongInt;
  begin
    rslt := DbiGetSeqNo(InTable.Handle, Recs);
    case rslt of
      DBIERR_NONE: Recno := Recs;
      DBIERR_BOF:  RecNo := 0;
      else
        RecNo := -1;
    end;
  end;

**************************************************************************
Steve Koterski                    "Knowledge advances by steps, and not by
Product Group Manager             leaps."
Delphi Technical Support                       -- Lord Macaulay, 1800-1859
Borland International, Inc.



Thu, 30 Jul 1998 03:00:00 GMT
 
 [ 6 post ] 

 Relevant Pages 

1. Variation on old theme - Adding BDE Aliases at runtime

2. Adding alias to BDE at run time

3. Changing/adding DB-Aliases run-time

4. how to add a BDE alias at runtime?

5. BDE - Add Alias at Runtime???

6. D3: how to add an alias in ODBC at runtime

7. aliases path at run time

8. Change BDE alias in run-time ?

9. Changing an alias at run-time

10. Changing the location of alias at run-time

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

12. changing alias in run-time..no effect ?


 
Powered by phpBB® Forum Software