一个让我困惑的问题
我编写了一个小软件,有ADOTable等控件,连接了一条mdb文件。但在本机上运行很正常,在另一台机上就会出错,错误如下“Excption EStackOverflow in module project1.exe at oooAFoc9 Stack overflow”我不知道为什么?希望有人答我拉!
代码如下:
着是unit1:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Grids, DBGrids, DBCtrls, DB, Mask, ADODB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
ADOTable1DSDesigner: TWideStringField;
ADOTable1DSDesigner2: TWideStringField;
ADOTable1DSDesigner3: TBCDField;
ADOTable1DSDesigner4: TBCDField;
Label1: TLabel;
DBEdit1: TDBEdit;
DataSource1: TDataSource;
Label2: TLabel;
DBEdit2: TDBEdit;
Label3: TLabel;
DBEdit3: TDBEdit;
Label4: TLabel;
DBComboBox1: TDBComboBox;
DBGrid1: TDBGrid;
StatusBar1: TStatusBar;
GroupBox1: TGroupBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
GroupBox2: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Button6: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOTable1.Insert ;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if ADOTable1.State = dsEdit then
ADOTable1.Post ;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if not ADOTable1.Eof then
begin
if Application.MessageBox('确认删除这笔数据?' ,'注意' MB_YESNO+MB_ICONQUESTION) = IDYES then
ADOTable1.Delete ;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
ADOTable1.Cancel ;
end;
procedure TForm1.Button5Click(Sender: TObject);
var
temp : integer ;
total : integer ;
begin
temp := 0 ;
total := 0 ;
ADOTable1.First ;
while not ADOTable1.Eof do
begin
temp := temp + ADOTable1.fields[2].AsInteger ;
total := total + ADOTable1.fields[3].AsInteger ;
ADOTable1.Next ;
end;
Label7.Caption := IntToStr(temp) ;
Label8.Caption := IntToStr(total) ;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Form2.Show ;
end;
end.
这是unit2:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls, DB, ADODB;
type
TForm2 = class(TForm)
ADOTable1: TADOTable;
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRShape1: TQRShape;
DetailBand1: TQRBand;
ColumnHeaderBand1: TQRBand;
QRSysData1: TQRSysData;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormShow(Sender: TObject);
begin
QuickRep1.Preview ;
end;
end.
希望有人回答我拉!