Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ALIAS (how ot reference in code)

Status
Not open for further replies.

guava65

Programmer
Jul 20, 2001
238
US
Hello,

Can someone give me an example of how to reference an alias via code? I'm trying to have a program look for a file via the alias name. I can do it if I reference the path but some users do not have the same path for the file location. The alias is the same though.

[dazed] I''ve frustrated myself trying to figure it out. I'm sure there is an easy way to do this that will seem obvious after I'm told about it.

Thanks in advance...[thumbsup2]



Aloha,
cg
 
you could use a OpenFile dialog to obtain the path to the file you want from the user then modify the alias to suit this new path. for this you need a TSession component through which you can access all the aliases defined in BDE using:

Code:
form1.Session1.ModifyAlias(Name: String; List: TStrings);
 
What I really want to do is reference the current alias programatically. No user interaction.

Any other suggestions?

ty

Aloha,
cg
 
TDatabase component has a property called AliasName which returns the alias name of the database connection. Then through the TSession component I mentioned before, you have the following methods:

function GetAliasDriverName(const AliasName: String): String;
procedure GetAliasParams(const AliasName: String; List: TStrings);

and a whole lot more so you can pretty much do whatever you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top