Search results for 'Alias'. 1 post(s) found.
- 2007/08/25 How can I modify aliases programmatically ?
Take a look at TDatabase. You can set the Alias property to the physical path at runtime. InstallShield Express, which ships with D2 and D3 (and greater)lets you define new aliases with paths relative to the directory where the user installs the program.
The code below modifies an Alias called test to point to directory c:dirname.
This uses the session variable and requires unit DBTables.
(Delphi Ref)
Session is responsible for maintaining all of the database components used by an application. It is created automatically as part of an application's initialization and destroyed as part of the application's termination. The Session variable must remain active at all times; it can not be destroyed and recreated.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DBTables;
type
TForm1 = class(TForm)
Button1: TButton;
Database1: TDatabase;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var List: TStringList;
begin
List := TStringList.Create; //A stringlist with the new value
List.Add('path=c:dirname'); //the dir you want
List.Add('driver name=paradox');
Session.ModifyAlias('test', List); //this method, make the changes
Session.SaveConfigFile; // This method, save the changes
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DBTables;
type
TForm1 = class(TForm)
Button1: TButton;
Database1: TDatabase;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var List: TStringList;
begin
List := TStringList.Create; //A stringlist with the new value
List.Add('path=c:dirname'); //the dir you want
List.Add('driver name=paradox');
Session.ModifyAlias('test', List); //this method, make the changes
Session.SaveConfigFile; // This method, save the changes
end;
end.
Another posts included in "Delphi"
| Get The Drive Type (0) | 2007/08/25 |
| How To Get Windows And System Directory (0) | 2007/08/25 |
| How To Get Volume Name (0) | 2007/08/25 |
| Setting TQuery SQL Statement (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 02:00
moneyideas
-
Subject different money making ideas
2010/01/29 10:14
moneyideas
-
Subject different money making ideas
2010/01/31 16:43
moneyideas

Prev

Rss Feed