16,749
社区成员
发帖
与我相关
我的任务
分享
Application.Initialize;
Application.CreateForm(Tdtmdl1, dtmdl1);
Application.CreateForm(Tinif, iniF);
if TLoginForm.ShowForm then
begin
Application.CreateForm(TIDCardRead_F, IDCardRead_F);
Application.CreateForm(TLeave, Leave);
Application.CreateForm(Tlavel, lavel);
end;
Application.Run;
procedure Tdtmdl1.DataModuleCreate(Sender: TObject);
var
ini_FileName:string;
begin
ini_FileName:=ExtractFilePath(Application.ExeName)+'conn.ini';
if not FileExists(ini_FileName)then
begin
Application.MessageBox('数据库文件不存在','信息提示',MB_OK);
Application.Terminate;
end;
with con1 do
con1.ConnectionString:=Get_Db_Con_Str(ini_FileName);
con1.Connected:=False;
try
con1.Connected:=True;
except
Application.MessageBox('数据库连接失败请联系管理员','信息提示',mb_ok);
//在这里弹出窗口。
end;
end;
procedure Tdtmdl1.DataModuleCreate(Sender: TObject);
var
ini_FileName:string;
begin
ini_FileName:=ExtractFilePath(Application.ExeName)+'conn.ini';
if not FileExists(ini_FileName)then
begin
Application.MessageBox('数据库文件不存在','信息提示',MB_OK);
Application.Terminate;
end;
with con1 do
con1.ConnectionString:=Get_Db_Con_Str(ini_FileName);
con1.Connected:=False;
try
con1.Connected:=True;
except
Application.MessageBox('数据库连接失败请联系管理员','信息提示',mb_ok);
iniF:=TiniF.Create(Application);
iniF.Show;
//这里弹出配置窗体。但是登陆窗体也同时弹出了。不知道上面原因。
end;
end;
Application.Initialize;
Application.CreateForm(Tdtmdl1, dtmdl1);
if not Assigned(iniF) then
begin
if TLoginForm.ShowForm then
begin
Application.CreateForm(TIDCardRead_F, IDCardRead_F);
Application.CreateForm(TLeave, Leave);
Application.CreateForm(Tlavel, lavel);
end;
end;
Application.Run;