You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
unit u_ini;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
StdCtrls, fcButton, fcImgBtn,inifiles;
|
|
|
|
type
|
|
Tfrm_ini = class(TForm)
|
|
GroupBox1: TGroupBox;
|
|
Edit1: TEdit;
|
|
Edit2: TEdit;
|
|
Edit3: TEdit;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
Edit4: TEdit;
|
|
fcImageBtn1: TfcImageBtn;
|
|
fcImageBtn2: TfcImageBtn;
|
|
procedure fcImageBtn2Click(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure fcImageBtn1Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_ini: Tfrm_ini;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
procedure Tfrm_ini.fcImageBtn2Click(Sender: TObject);
|
|
begin
|
|
application.Terminate;
|
|
end;
|
|
|
|
procedure Tfrm_ini.FormShow(Sender: TObject);
|
|
var
|
|
inifile1:Tinifile;
|
|
begin
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
edit4.text:=copy(inifile1.ReadString('database','Password',''),0,length(inifile1.ReadString('database','Password',''))-1);
|
|
edit3.text:=copy(inifile1.ReadString('database','User ID',''),0,length(inifile1.ReadString('database','User ID',''))-1);
|
|
edit2.text:=copy(inifile1.ReadString('database','Initial Catalog',''),0,length(inifile1.ReadString('database','Initial Catalog',''))-1);
|
|
edit1.text:=copy(inifile1.ReadString('database','Data Source',''),0,length(inifile1.ReadString('database','Data Source',''))-1);
|
|
end;
|
|
|
|
procedure Tfrm_ini.fcImageBtn1Click(Sender: TObject);
|
|
var
|
|
inifile1:Tinifile;
|
|
begin
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
inifile1.WriteString('database','Password',edit4.text+';');
|
|
inifile1.WriteString('database','User ID',edit3.text+';');
|
|
inifile1.WriteString('database','Initial Catalog',edit2.text+';');
|
|
inifile1.WriteString('database','Data Source',edit1.text+';');
|
|
end;
|
|
|
|
end.
|