-
Notifications
You must be signed in to change notification settings - Fork 1
/
U_DataModule.pas
71 lines (55 loc) · 1.47 KB
/
U_DataModule.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
unit U_DataModule;
interface
uses
System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls,
Data.DB, Data.SqlExpr, Data.DbxSqlite, Data.FMTBcd, Datasnap.Provider,
Datasnap.DBClient,Vcl.Dialogs,Vcl.Forms;
type
TDataModule1 = class(TDataModule)
ImageList1: TImageList;
SqliteConnection: TSQLConnection;
SqlActions: TSQLQuery;
ReturnParameters: TSQLQuery;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure ConnectionExecute(pathFile : String);
end;
var
DataModule1 : TDataModule1;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
uses U_SelectDatabase, U_Menu;
procedure TDataModule1.ConnectionExecute(pathFile : String);
begin
SqliteConnection.Params.Values['DataBase'] := pathFile + 'database.db';
SqliteConnection.Connected := True;
end;
procedure TDataModule1.DataModuleCreate(Sender: TObject);
var
error : boolean;
path : String;
begin
path := ExtractFilePath(ParamStr(0));
try
ConnectionExecute(path);
except
on e:exception do
begin
Connected_Validation := False;
Application.CreateForm(TFrSelectDatabase,FrSelectDatabase);
FrSelectDatabase.ShowModal;
if Connected_Validation = True then
begin
ConnectionExecute(path);
FrSelectDatabase.Free;
Application.CreateForm(TFrMenu,FrMenu);
FrMenu.ShowModal;
end;
end;
end;
end;
end.