如题
解决方案 »
- delphi内存泄露,请帮忙,提示为out of memory
- 鼠标绘制老显示繁忙
- WinIO,能不能在后台模拟键盘输入。
- createprocessW应该怎么调用?
- 想问下如何获得摄像头的安装的驱动名称和一些硬件信息
- 小声问一下:Delphi在串口编程方面的优劣势
- Application属于哪个单元
- 将面向对象的思想贯穿始终--谈Delphi开发(提高篇)
- 请教:如何在statusbar的panel中显示一个图标呢?
- 有谁写过f1book程序,有例子让小弟看一下吗?E_mail:[email protected]
- 我只有这30分了,一个高难度问题要向大家请教(关于创建及放弃)!
- 如何控制EXCEL的行高和列宽?
var CanClose: Boolean);
begin
inherited;
if Querymain.State in [dsInsert,dsEdit] then
Querymain.post;
if Querymain.UpdatesPending then
if MessageBox(Handle,'当前修改的记录没有被保存,确认退出吗','询问',
MB_ICONQUESTION+MB_YESNO) = MrYes then
begin
CanClose := True;
QueryMain.close;
end
else
CanClose := False;
end;
不知还要设置些什么,我取table1.UpdatesPending 始终为false
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Db, DBTables, Grids, DBGrids;type
TForm1 = class(TForm)
DBGrid1: TDBGrid;
Database1: TDatabase;
Table1: TTable;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
begin
Table1.Active:=true;
end;procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if Table1.State in [dsInsert,dsEdit] then
Table1.post;
if Table1.UpdatesPending then
if MessageBox(Handle,'当前修改的记录没有被保存,确认退出吗','询问',
MB_ICONQUESTION+MB_YESNO) = MrYes then
begin
CanClose := True;
Table1.close;
end
else
CanClose := False;end;end.
但我用DBNavigator能判断
如果是三层,可用ClientDataSet1.ChangeCount>0 来检测。