[求助]我做的程序在加上数据库之后,别人就不能用了。哪位好心人给解决一下好不?
我是刚学delphi的,刚做了一个小测试的程序。可是再加载完数据库之后,同学都反映看不了,说是程序出错。这是为什么呢?我很是不明白的。他们说放置数据库的路径没有错。以下是代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGrids, Db, DBTables, StdCtrls, ComCtrls, Menus, ExtCtrls,
Buttons;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit3: TEdit;
Edit4: TEdit;
DataSource1: TDataSource;
Table1: TTable;
DBGrid1: TDBGrid;
DataSource2: TDataSource;
Table2: TTable;
DataSource3: TDataSource;
Table3: TTable;
DataSource4: TDataSource;
Table4: TTable;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit2: TEdit;
Label5: TLabel;
BitBtn1: TBitBtn;
Label6: TLabel;
Label7: TLabel;
BitBtn2: TBitBtn;
Label8: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Edit4Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
showmessage('baby~好狠心哪,这就不测了?我哭~折腾了好半天才做出来的,很是辛苦的说...');
close; {点击之后显示所输入语句}
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
if length(edit1.Text)=1 then
form1.FocusControl(Edit2);
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
if length(edit2.Text)=1 then
form1.FocusControl(Edit3);
end;
procedure TForm1.Edit3Change(Sender: TObject);
begin
if length(edit3.Text)=1 then
form1.FocusControl(Edit4);
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
with table1 do
begin
filter:=format('首字母=''%s'''{字符串},[edit1.text+'*']);
filtered:=true; {当寻找的关键字符合标准,则跳至数据库该项目处}
end;
with table2 do
begin
filter:=format('首字母=''%s''',[edit2.text+'*']);
filtered:=true;
end;
with table3 do
begin
filter:=format('字母=''%s''',[edit3.text+'*']);
filtered:=true;
end;
with table4 do
begin
filter:=format('字母=''%s''',[edit4.text+'*']);
filtered:=true;
end;
end;
procedure TForm1.Edit4Change(Sender: TObject);
begin
if length(edit4.Text)=1 then
form1.FocusControl(BitBtn2);{如果字符长度为1,则激活bitbtn2}
end;
end.