U
unixhost
Unregistered / Unconfirmed
GUEST, unregistred user!
query1:cannot modify a read-only dataset
我的代码如下:
procedure TfmMain.Button2Click(Sender: TObject);
begin
with DataModule1 do
begin
query1.Open;
query1.Append;
query1.Edit ;
query1.FieldByName('shijian').AsDateTime:=DateTimePicker1.Date;
query1.FieldByName('fuwu').AsString:=ComboBox2.Text;
query1.FieldByName('zhixing').AsString:=ComboBox3.Text;
query1.FieldByName('zhishu').AsString:=Edit6.Text;
query1.FieldByName('jiqian').AsString:=Edit5.Text;
try
query1.Post ;
showmessage('信息已经加入!');
except
on E:Exception do
query1.Cancel ;
end;
end;
end;
数据库是SQL SERVER 7.0
我的代码如下:
procedure TfmMain.Button2Click(Sender: TObject);
begin
with DataModule1 do
begin
query1.Open;
query1.Append;
query1.Edit ;
query1.FieldByName('shijian').AsDateTime:=DateTimePicker1.Date;
query1.FieldByName('fuwu').AsString:=ComboBox2.Text;
query1.FieldByName('zhixing').AsString:=ComboBox3.Text;
query1.FieldByName('zhishu').AsString:=Edit6.Text;
query1.FieldByName('jiqian').AsString:=Edit5.Text;
try
query1.Post ;
showmessage('信息已经加入!');
except
on E:Exception do
query1.Cancel ;
end;
end;
end;
数据库是SQL SERVER 7.0