J
jsw0525
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大虾,我采用DBExpress中的控件SimpleDataSet进行数据库修改,具体代码如下,可是不行,不知道这个控件是如何进行修改的(ADO控件中的ADODATASET用如下代码修改是没有问题的),好急,希望各位帮忙了.
SQLConnection1.Connected := False;
SQLConnection1.Connected := True;
with SimpleDataSet1 do
begin
Connection := SQLConnection1;
open;
edit;
FieldByName('Facility_Id').AsString:=trim(cxDBTextEdit1.Text);
FieldByName('Facility_Name').AsString:=trim(cxDBTextEdit3.Text);
FieldByName('Ip_Address').AsString:=trim(cxDBTextEdit2.Text);
FieldByName('Access_Time').AsDateTime:= wwDBDateTimePicker1.DateTime;
post;
ApplyUpdates(-1);
showmessage('修改成功!');
end;
SQLConnection1.Connected := False;
SQLConnection1.Connected := True;
SQLConnection1.Connected := False;
SQLConnection1.Connected := True;
with SimpleDataSet1 do
begin
Connection := SQLConnection1;
open;
edit;
FieldByName('Facility_Id').AsString:=trim(cxDBTextEdit1.Text);
FieldByName('Facility_Name').AsString:=trim(cxDBTextEdit3.Text);
FieldByName('Ip_Address').AsString:=trim(cxDBTextEdit2.Text);
FieldByName('Access_Time').AsDateTime:= wwDBDateTimePicker1.DateTime;
post;
ApplyUpdates(-1);
showmessage('修改成功!');
end;
SQLConnection1.Connected := False;
SQLConnection1.Connected := True;