Intersting D3/Access Bug
Heres an interesting bug in D3 if you have Access 95 or 97 on Win 95 or
Win NT. It seems to occur with MSACCESS or ODBC drivers.
Drop a ttable on a form and a button, click up the button handler as
shown. Set the table database and name properties to an existing Access
databse and table. Now compile and run. You should see the message
"You shouldn't see this message" instead of the expected exception. It
also works for d:=d/0; After the ln(d) you will see a neat little -NAN
value in d or a -INF after the div by zero.
Oh and the next trunc or database operation that occurs after this (can
be many many instructions away) will fall over with a weird error.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, Db, DBTables;
type
TForm1 = class(TForm)
Button1: TButton;
Table1: TTable;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var d:double;
begin
try
table1.open;
d:=-987;
d:=ln(d);
showmessage('You shouldn''t see this message');
except
showmessage('Um Problem with calc');
end;
end;
end.
DFM
object Form1: TForm1
Left = 250
Top = 140
Width = 696
Height = 480
Caption = 'Form1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 152
Top = 64
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Table1: TTable
DatabaseName = 'MYTEST'
TableName = 'Table1'
Left = 104
Top = 64
end
end
--
David H. Bolton