5 个解决方案
#1
首先的创建一个启动欢迎界面,假设该窗体叫form1
则应该将form1有autocreate该为available。
在project.dpr 中修改,下面是一段例子:
form1:=Tform1.create(application);
form1.show;
form1.update;
Application.Initialize;
Application.CreateForm(TForm2, Form2);
//连接数据库
Application.Run;
则应该将form1有autocreate该为available。
在project.dpr 中修改,下面是一段例子:
form1:=Tform1.create(application);
form1.show;
form1.update;
Application.Initialize;
Application.CreateForm(TForm2, Form2);
//连接数据库
Application.Run;
#2
program P_mian;
uses
Forms,
U_MaintMan in 'U_MaintMan.pas' {Form1},
U_dm in 'U_dm.pas' {dm: TDataModule},
U_input in 'U_input.pas' {Form2},
U_input1 in 'U_input1.pas' {Form3},
U_login in 'U_login.pas' {Form4},
U_FLASH in 'U_FLASH.pas' {Form5};
var i: integer;
{$R *.res}
begin
Application.Initialize;
FORM5:=TFORM5.create(application);
FORM5.Show;
FORM5.update;
Application.Title := '南宁富通公司';
Application.CreateForm(Tdm, dm);
Application.CreateForm(TForm1, Form1);
连接数据库
Application.CreateForm(TForm4, Form4);
for i:=0 to 400000000 do
if i=400000000 then begin
FORM5.Free;
application.ProcessMessages;
form4.ShowModal;
end;
Application.Run;
end.
uses
Forms,
U_MaintMan in 'U_MaintMan.pas' {Form1},
U_dm in 'U_dm.pas' {dm: TDataModule},
U_input in 'U_input.pas' {Form2},
U_input1 in 'U_input1.pas' {Form3},
U_login in 'U_login.pas' {Form4},
U_FLASH in 'U_FLASH.pas' {Form5};
var i: integer;
{$R *.res}
begin
Application.Initialize;
FORM5:=TFORM5.create(application);
FORM5.Show;
FORM5.update;
Application.Title := '南宁富通公司';
Application.CreateForm(Tdm, dm);
Application.CreateForm(TForm1, Form1);
连接数据库
Application.CreateForm(TForm4, Form4);
for i:=0 to 400000000 do
if i=400000000 then begin
FORM5.Free;
application.ProcessMessages;
form4.ShowModal;
end;
Application.Run;
end.
#3
一、欢迎界面可修改Temp.dpr如下
program Temp;
uses
Forms,
main in 'main.pas' {MainForm}, //主界面
active in 'active.pas' {ActiveForm}; //欢迎界面
{$R *.res}
begin
Application.Initialize;
ActiveForm:=TActiveForm.Create(Application);
ActiveForm.Width:=500; //大小自定
ActiveForm.Height:=350;
ActiveForm.Position:=poDesktopCenter;
ActiveForm.Show;
ActiveForm.Update;
Application.CreateForm(TMainForm,MainForm);
ActiveForm.Hide;
ActiveForm.Free;
Application.Run;
end.
二、可用Try..Except查检数据库是否连接正常
若连接不正常,可自行选择数据库别名及表如下
procedure TMainForm.FormCreate(Sender: TObject);
begin
///////////数据库别名列表///////////////////////////
Screen.Cursor := crHourglass;
with ListBox_DataSource do
begin
Items.Clear;
Session.GetAliasNames(Items);
end;
Screen.Cursor := crDefault;
if ListBox_DataSource.Items.Count < 1 then
MessageDlg( '系统没有发现数据库别名,你必须至少定义一个别名并连接数据库。',mtError, [mbOK], 0 );
///////////数据库别名列表///////////////////////////
end;
procedure TMainForm.ListBox_DataSourceClick(Sender: TObject);
var
strValue: string;
begin
///////////选择数据库别名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue := Items.Strings[ItemIndex];
ListBox_Database.Items.Clear;
Session.GetTableNames(strValue,'',False,False,ListBox_Database.Items);
Screen.Cursor := crDefault;
if ListBox_Database.Items.Count < 1 then
begin
MessageDlg('你选择的数据库没有表,请选择其它...', mtError, [mbOK], 0 );
Exit;
end else
begin
Table.DatabaseName:=strValue;
end;
///////////选择数据库别名///////////////////////////
end;
procedure TMainForm.ListBox_DatabaseClick(Sender: TObject);
var
strValue_Database: string;
strValue_DataSource: string;
i: Integer;
begin
///////////选择数据库表名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue_DataSource := Items.Strings[ItemIndex];
with ListBox_Database do
strValue_Database := Items.Strings[ItemIndex];
Session.GetFieldNames(strValue_DataSource,strValue_Database,ComboBox.Items);
Screen.Cursor := crDefault;
if ComboBox.Items.Count < 1 then
begin
MessageDlg('你选择的表字段为空,请选择其它...', mtError, [mbOK], 0 );
end else
begin
Table.TableName:=strValue_Database;
Table.Active:=True;
ComboBox.ItemIndex:=0;
end;
///////////选择数据库表名///////////////////////////
end;
program Temp;
uses
Forms,
main in 'main.pas' {MainForm}, //主界面
active in 'active.pas' {ActiveForm}; //欢迎界面
{$R *.res}
begin
Application.Initialize;
ActiveForm:=TActiveForm.Create(Application);
ActiveForm.Width:=500; //大小自定
ActiveForm.Height:=350;
ActiveForm.Position:=poDesktopCenter;
ActiveForm.Show;
ActiveForm.Update;
Application.CreateForm(TMainForm,MainForm);
ActiveForm.Hide;
ActiveForm.Free;
Application.Run;
end.
二、可用Try..Except查检数据库是否连接正常
若连接不正常,可自行选择数据库别名及表如下
procedure TMainForm.FormCreate(Sender: TObject);
begin
///////////数据库别名列表///////////////////////////
Screen.Cursor := crHourglass;
with ListBox_DataSource do
begin
Items.Clear;
Session.GetAliasNames(Items);
end;
Screen.Cursor := crDefault;
if ListBox_DataSource.Items.Count < 1 then
MessageDlg( '系统没有发现数据库别名,你必须至少定义一个别名并连接数据库。',mtError, [mbOK], 0 );
///////////数据库别名列表///////////////////////////
end;
procedure TMainForm.ListBox_DataSourceClick(Sender: TObject);
var
strValue: string;
begin
///////////选择数据库别名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue := Items.Strings[ItemIndex];
ListBox_Database.Items.Clear;
Session.GetTableNames(strValue,'',False,False,ListBox_Database.Items);
Screen.Cursor := crDefault;
if ListBox_Database.Items.Count < 1 then
begin
MessageDlg('你选择的数据库没有表,请选择其它...', mtError, [mbOK], 0 );
Exit;
end else
begin
Table.DatabaseName:=strValue;
end;
///////////选择数据库别名///////////////////////////
end;
procedure TMainForm.ListBox_DatabaseClick(Sender: TObject);
var
strValue_Database: string;
strValue_DataSource: string;
i: Integer;
begin
///////////选择数据库表名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue_DataSource := Items.Strings[ItemIndex];
with ListBox_Database do
strValue_Database := Items.Strings[ItemIndex];
Session.GetFieldNames(strValue_DataSource,strValue_Database,ComboBox.Items);
Screen.Cursor := crDefault;
if ComboBox.Items.Count < 1 then
begin
MessageDlg('你选择的表字段为空,请选择其它...', mtError, [mbOK], 0 );
end else
begin
Table.TableName:=strValue_Database;
Table.Active:=True;
ComboBox.ItemIndex:=0;
end;
///////////选择数据库表名///////////////////////////
end;
#4
好东西!收藏!
#5
begin
Application.Initialize;
//-----------------创建数据模块,以完成数据库连接工作---------------------------
Application.Title := '出租车(收费)管理系统';
Application.CreateForm(TDataModule1, DataModule1);
f_flash:=tf_flash.Create(application);
f_flash.Show;
//-----------------显示用户登录窗口---------------------------------------------
f_yhdl:=tf_yhdl.Create(nil);
f_yhdl.ShowModal;
//-----------------如果用户登录成功则程序继续运行-------------------------------
if f_yhdl.ModalResult=mrok then
begin
Application.CreateForm(Tf_main, f_main);
f_main.show;
end;
Application.Run;
end.
写在工文件里。
Application.Initialize;
//-----------------创建数据模块,以完成数据库连接工作---------------------------
Application.Title := '出租车(收费)管理系统';
Application.CreateForm(TDataModule1, DataModule1);
f_flash:=tf_flash.Create(application);
f_flash.Show;
//-----------------显示用户登录窗口---------------------------------------------
f_yhdl:=tf_yhdl.Create(nil);
f_yhdl.ShowModal;
//-----------------如果用户登录成功则程序继续运行-------------------------------
if f_yhdl.ModalResult=mrok then
begin
Application.CreateForm(Tf_main, f_main);
f_main.show;
end;
Application.Run;
end.
写在工文件里。
#1
首先的创建一个启动欢迎界面,假设该窗体叫form1
则应该将form1有autocreate该为available。
在project.dpr 中修改,下面是一段例子:
form1:=Tform1.create(application);
form1.show;
form1.update;
Application.Initialize;
Application.CreateForm(TForm2, Form2);
//连接数据库
Application.Run;
则应该将form1有autocreate该为available。
在project.dpr 中修改,下面是一段例子:
form1:=Tform1.create(application);
form1.show;
form1.update;
Application.Initialize;
Application.CreateForm(TForm2, Form2);
//连接数据库
Application.Run;
#2
program P_mian;
uses
Forms,
U_MaintMan in 'U_MaintMan.pas' {Form1},
U_dm in 'U_dm.pas' {dm: TDataModule},
U_input in 'U_input.pas' {Form2},
U_input1 in 'U_input1.pas' {Form3},
U_login in 'U_login.pas' {Form4},
U_FLASH in 'U_FLASH.pas' {Form5};
var i: integer;
{$R *.res}
begin
Application.Initialize;
FORM5:=TFORM5.create(application);
FORM5.Show;
FORM5.update;
Application.Title := '南宁富通公司';
Application.CreateForm(Tdm, dm);
Application.CreateForm(TForm1, Form1);
连接数据库
Application.CreateForm(TForm4, Form4);
for i:=0 to 400000000 do
if i=400000000 then begin
FORM5.Free;
application.ProcessMessages;
form4.ShowModal;
end;
Application.Run;
end.
uses
Forms,
U_MaintMan in 'U_MaintMan.pas' {Form1},
U_dm in 'U_dm.pas' {dm: TDataModule},
U_input in 'U_input.pas' {Form2},
U_input1 in 'U_input1.pas' {Form3},
U_login in 'U_login.pas' {Form4},
U_FLASH in 'U_FLASH.pas' {Form5};
var i: integer;
{$R *.res}
begin
Application.Initialize;
FORM5:=TFORM5.create(application);
FORM5.Show;
FORM5.update;
Application.Title := '南宁富通公司';
Application.CreateForm(Tdm, dm);
Application.CreateForm(TForm1, Form1);
连接数据库
Application.CreateForm(TForm4, Form4);
for i:=0 to 400000000 do
if i=400000000 then begin
FORM5.Free;
application.ProcessMessages;
form4.ShowModal;
end;
Application.Run;
end.
#3
一、欢迎界面可修改Temp.dpr如下
program Temp;
uses
Forms,
main in 'main.pas' {MainForm}, //主界面
active in 'active.pas' {ActiveForm}; //欢迎界面
{$R *.res}
begin
Application.Initialize;
ActiveForm:=TActiveForm.Create(Application);
ActiveForm.Width:=500; //大小自定
ActiveForm.Height:=350;
ActiveForm.Position:=poDesktopCenter;
ActiveForm.Show;
ActiveForm.Update;
Application.CreateForm(TMainForm,MainForm);
ActiveForm.Hide;
ActiveForm.Free;
Application.Run;
end.
二、可用Try..Except查检数据库是否连接正常
若连接不正常,可自行选择数据库别名及表如下
procedure TMainForm.FormCreate(Sender: TObject);
begin
///////////数据库别名列表///////////////////////////
Screen.Cursor := crHourglass;
with ListBox_DataSource do
begin
Items.Clear;
Session.GetAliasNames(Items);
end;
Screen.Cursor := crDefault;
if ListBox_DataSource.Items.Count < 1 then
MessageDlg( '系统没有发现数据库别名,你必须至少定义一个别名并连接数据库。',mtError, [mbOK], 0 );
///////////数据库别名列表///////////////////////////
end;
procedure TMainForm.ListBox_DataSourceClick(Sender: TObject);
var
strValue: string;
begin
///////////选择数据库别名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue := Items.Strings[ItemIndex];
ListBox_Database.Items.Clear;
Session.GetTableNames(strValue,'',False,False,ListBox_Database.Items);
Screen.Cursor := crDefault;
if ListBox_Database.Items.Count < 1 then
begin
MessageDlg('你选择的数据库没有表,请选择其它...', mtError, [mbOK], 0 );
Exit;
end else
begin
Table.DatabaseName:=strValue;
end;
///////////选择数据库别名///////////////////////////
end;
procedure TMainForm.ListBox_DatabaseClick(Sender: TObject);
var
strValue_Database: string;
strValue_DataSource: string;
i: Integer;
begin
///////////选择数据库表名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue_DataSource := Items.Strings[ItemIndex];
with ListBox_Database do
strValue_Database := Items.Strings[ItemIndex];
Session.GetFieldNames(strValue_DataSource,strValue_Database,ComboBox.Items);
Screen.Cursor := crDefault;
if ComboBox.Items.Count < 1 then
begin
MessageDlg('你选择的表字段为空,请选择其它...', mtError, [mbOK], 0 );
end else
begin
Table.TableName:=strValue_Database;
Table.Active:=True;
ComboBox.ItemIndex:=0;
end;
///////////选择数据库表名///////////////////////////
end;
program Temp;
uses
Forms,
main in 'main.pas' {MainForm}, //主界面
active in 'active.pas' {ActiveForm}; //欢迎界面
{$R *.res}
begin
Application.Initialize;
ActiveForm:=TActiveForm.Create(Application);
ActiveForm.Width:=500; //大小自定
ActiveForm.Height:=350;
ActiveForm.Position:=poDesktopCenter;
ActiveForm.Show;
ActiveForm.Update;
Application.CreateForm(TMainForm,MainForm);
ActiveForm.Hide;
ActiveForm.Free;
Application.Run;
end.
二、可用Try..Except查检数据库是否连接正常
若连接不正常,可自行选择数据库别名及表如下
procedure TMainForm.FormCreate(Sender: TObject);
begin
///////////数据库别名列表///////////////////////////
Screen.Cursor := crHourglass;
with ListBox_DataSource do
begin
Items.Clear;
Session.GetAliasNames(Items);
end;
Screen.Cursor := crDefault;
if ListBox_DataSource.Items.Count < 1 then
MessageDlg( '系统没有发现数据库别名,你必须至少定义一个别名并连接数据库。',mtError, [mbOK], 0 );
///////////数据库别名列表///////////////////////////
end;
procedure TMainForm.ListBox_DataSourceClick(Sender: TObject);
var
strValue: string;
begin
///////////选择数据库别名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue := Items.Strings[ItemIndex];
ListBox_Database.Items.Clear;
Session.GetTableNames(strValue,'',False,False,ListBox_Database.Items);
Screen.Cursor := crDefault;
if ListBox_Database.Items.Count < 1 then
begin
MessageDlg('你选择的数据库没有表,请选择其它...', mtError, [mbOK], 0 );
Exit;
end else
begin
Table.DatabaseName:=strValue;
end;
///////////选择数据库别名///////////////////////////
end;
procedure TMainForm.ListBox_DatabaseClick(Sender: TObject);
var
strValue_Database: string;
strValue_DataSource: string;
i: Integer;
begin
///////////选择数据库表名///////////////////////////
Table.Active:=False;
with ListBox_DataSource do
strValue_DataSource := Items.Strings[ItemIndex];
with ListBox_Database do
strValue_Database := Items.Strings[ItemIndex];
Session.GetFieldNames(strValue_DataSource,strValue_Database,ComboBox.Items);
Screen.Cursor := crDefault;
if ComboBox.Items.Count < 1 then
begin
MessageDlg('你选择的表字段为空,请选择其它...', mtError, [mbOK], 0 );
end else
begin
Table.TableName:=strValue_Database;
Table.Active:=True;
ComboBox.ItemIndex:=0;
end;
///////////选择数据库表名///////////////////////////
end;
#4
好东西!收藏!
#5
begin
Application.Initialize;
//-----------------创建数据模块,以完成数据库连接工作---------------------------
Application.Title := '出租车(收费)管理系统';
Application.CreateForm(TDataModule1, DataModule1);
f_flash:=tf_flash.Create(application);
f_flash.Show;
//-----------------显示用户登录窗口---------------------------------------------
f_yhdl:=tf_yhdl.Create(nil);
f_yhdl.ShowModal;
//-----------------如果用户登录成功则程序继续运行-------------------------------
if f_yhdl.ModalResult=mrok then
begin
Application.CreateForm(Tf_main, f_main);
f_main.show;
end;
Application.Run;
end.
写在工文件里。
Application.Initialize;
//-----------------创建数据模块,以完成数据库连接工作---------------------------
Application.Title := '出租车(收费)管理系统';
Application.CreateForm(TDataModule1, DataModule1);
f_flash:=tf_flash.Create(application);
f_flash.Show;
//-----------------显示用户登录窗口---------------------------------------------
f_yhdl:=tf_yhdl.Create(nil);
f_yhdl.ShowModal;
//-----------------如果用户登录成功则程序继续运行-------------------------------
if f_yhdl.ModalResult=mrok then
begin
Application.CreateForm(Tf_main, f_main);
f_main.show;
end;
Application.Run;
end.
写在工文件里。