河
河清
Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是D7 (Build 4.453)
以下代码在D6.02下正常,在D7下无法通过。
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Form 代码
object Form1: TForm1
Left = 192
Top = 114
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 416
Top = 160
Width = 120
Height = 13
Caption = '请更改数据然后按按钮'
end
object DBGrid1: TDBGrid
Left = 16
Top = 48
Width = 320
Height = 361
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object Button1: TButton
Left = 464
Top = 184
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object IBDatabase1: TIBDatabase
DatabaseName =
'C:/Program Files/Borland/InterBase/examples/database/employee.gd' +
'b'
Params.Strings = (
'')
DefaultTransaction = IBTransaction1
IdleTimer = 0
SQLDialect = 1
TraceFlags = []
Left = 96
Top = 88
end
object IBTransaction1: TIBTransaction
Active = False
DefaultDatabase = IBDatabase1
Params.Strings = (
'read_committed'
'rec_version'
'nowait')
AutoStopAction = saNone
Left = 152
Top = 88
end
object IBQuery1: TIBQuery
Database = IBDatabase1
Transaction = IBTransaction1
BufferChunks = 1000
CachedUpdates = False
SQL.Strings = (
'select * from COUNTRY')
Left = 96
Top = 144
end
object DataSetProvider1: TDataSetProvider
DataSet = IBQuery1
Options = [poIncFieldProps]
Left = 152
Top = 144
end
object ClientDataSet1: TClientDataSet
Active = True
Aggregates = <>
Params = <>
ProviderName = 'DataSetProvider1'
Left = 200
Top = 152
end
object DataSource1: TDataSource
DataSet = ClientDataSet1
Left = 264
Top = 160
end
end
unit 代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB, DBClient, IBCustomDataSet,
Provider, IBQuery, IBDatabase;
type
TForm1 = class(TForm)
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
IBQuery1: TIBQuery;
DataSetProvider1: TDataSetProvider;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if ClientDataSet1.ApplyUpdates(0)=0 then
showmessage('s');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ClientDataSet1.Active:=True;
end;
end.
以下代码在D6.02下正常,在D7下无法通过。
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Form 代码
object Form1: TForm1
Left = 192
Top = 114
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 416
Top = 160
Width = 120
Height = 13
Caption = '请更改数据然后按按钮'
end
object DBGrid1: TDBGrid
Left = 16
Top = 48
Width = 320
Height = 361
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object Button1: TButton
Left = 464
Top = 184
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object IBDatabase1: TIBDatabase
DatabaseName =
'C:/Program Files/Borland/InterBase/examples/database/employee.gd' +
'b'
Params.Strings = (
'')
DefaultTransaction = IBTransaction1
IdleTimer = 0
SQLDialect = 1
TraceFlags = []
Left = 96
Top = 88
end
object IBTransaction1: TIBTransaction
Active = False
DefaultDatabase = IBDatabase1
Params.Strings = (
'read_committed'
'rec_version'
'nowait')
AutoStopAction = saNone
Left = 152
Top = 88
end
object IBQuery1: TIBQuery
Database = IBDatabase1
Transaction = IBTransaction1
BufferChunks = 1000
CachedUpdates = False
SQL.Strings = (
'select * from COUNTRY')
Left = 96
Top = 144
end
object DataSetProvider1: TDataSetProvider
DataSet = IBQuery1
Options = [poIncFieldProps]
Left = 152
Top = 144
end
object ClientDataSet1: TClientDataSet
Active = True
Aggregates = <>
Params = <>
ProviderName = 'DataSetProvider1'
Left = 200
Top = 152
end
object DataSource1: TDataSource
DataSet = ClientDataSet1
Left = 264
Top = 160
end
end
unit 代码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB, DBClient, IBCustomDataSet,
Provider, IBQuery, IBDatabase;
type
TForm1 = class(TForm)
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
IBQuery1: TIBQuery;
DataSetProvider1: TDataSetProvider;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
if ClientDataSet1.ApplyUpdates(0)=0 then
showmessage('s');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ClientDataSet1.Active:=True;
end;
end.