query.applyupdates
修改按钮的click事件:
dbe_name.readonly:=false;
dbe_sex.readonly:=false;
dbe_age.readonly:=false;
提交按钮的click事件:
if messagedlg('确实要提交所有的更新操作吗?yes是,no否',mtconfirmation,[mbyes,mbno],0)=mryes then
begin
try
datam.qr.ApplyUpdates;
except
showmessage('提交失败!请重新操作');
datam.qr.cancelupdates;
exit;
end;
datam.qr.CommitUpdates;
dbe_no.ReadOnly:=true;
dbe_name.ReadOnly:=true;
dbe_sex.ReadOnly:=true;
dbe_age.ReadOnly:=true;
代码有问题吗? 为什么总是提交不到数据库里??求助!!!
修改按钮的click事件:
dbe_name.readonly:=false;
dbe_sex.readonly:=false;
dbe_age.readonly:=false;
提交按钮的click事件:
if messagedlg('确实要提交所有的更新操作吗?yes是,no否',mtconfirmation,[mbyes,mbno],0)=mryes then
begin
try
datam.qr.ApplyUpdates;
except
showmessage('提交失败!请重新操作');
datam.qr.cancelupdates;
exit;
end;
datam.qr.CommitUpdates;
dbe_no.ReadOnly:=true;
dbe_name.ReadOnly:=true;
dbe_sex.ReadOnly:=true;
dbe_age.ReadOnly:=true;
代码有问题吗? 为什么总是提交不到数据库里??求助!!!
你用了很多dbgrid嗎﹖ ,設了那么多readonly﹐只要一個 dbgrid.readonly就夠了呀。
從上面看你的提交代碼也看不出什么問題呀。建議吧錯誤提示貼出來看看。
No SQL statement available.
对不起 ,在这里不能 粘贴图的。所以只能把提示代码写过了(我不能不图 抓过来)。
请 各位大哥大姐 帮忙。
点保存按钮,Query.post.你用的是DBEdit,把这个控件跟Query相关字段连好,不就保存了吗?
if messagedlg('确实要提交所有的更新操作吗?yes是,no否',mtconfirmation,[mbyes,mbno],0)=mryes then
begin
try
if query.state in [dsEdit, dsInsert] then
query.post; datam.qr.ApplyUpdates(all);
except
showmessage('提交失败!请重新操作');
datam.qr.cancelupdates;
exit;
end;
datam.qr.CommitUpdates;
dbe_no.ReadOnly:=true;
dbe_name.ReadOnly:=true;
dbe_sex.ReadOnly:=true;
dbe_age.ReadOnly:=true;
代码有问题吗? 为什么总是提交不到数据库里??求助!!!
“点修改按钮:Query.edit;
点保存按钮,Query.post.你用的是DBEdit,把这个控件跟Query相关字段连好,不就保存了吗?”
都不行“if query.state in [dsEdit, dsInsert] then
query.post; datam.qr.ApplyUpdates(all);”
**对查询的结果数据 进行修改后 为什么 提交不到 数据库里去???
begin
try
datam.qr.StartTransaction;/////新增
datam.qr.ApplyUpdates;
except
showmessage('提交失败!请重新操作');
datam.qr.cancelupdates;
exit;
end;