G
gzgchan
Unregistered / Unconfirmed
GUEST, unregistred user!
有下面的一段代码,是通过dbExpress向数据库中添加资料,其中SQLConnection1、SimpleDataSet1已配置好调用mySQL数据库,
但是运行下面代码时,不会报任何错误(通过)。但是发现实际数据库中并未改动过,是何原因?
其中CommandType已设为ctTable;
type
TForm1 = class(TForm)
SQLConnection1: TSQLConnection;
SimpleDataSet1: TSimpleDataSet;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
SimpleDataSet1.Append;
SimpleDataSet1.FieldByName('name').asstring:='First Name';
SimpleDataSet1.post;
SimpleDataSet1.Close;
end;
end.
但是运行下面代码时,不会报任何错误(通过)。但是发现实际数据库中并未改动过,是何原因?
其中CommandType已设为ctTable;
type
TForm1 = class(TForm)
SQLConnection1: TSQLConnection;
SimpleDataSet1: TSimpleDataSet;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
SimpleDataSet1.Append;
SimpleDataSet1.FieldByName('name').asstring:='First Name';
SimpleDataSet1.post;
SimpleDataSet1.Close;
end;
end.