更新bindsource和ListView [英] Update bindsource and listview
本文介绍了更新bindsource和ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作的一个Delphi XE5 Firemonkey美孚应用程序。
I am working on a Delphi XE5 Firemonkey Mobil app.
我用FireDac进行连接。
I use FireDac for connection.
只是做一个简单的查询INSERT INTO SQLite数据库和更新列表视图与插入的信息。
Just trying to do a simple query insert into sQlite database and update the listview with the inserted info.
procedure TTabbedwithNavigationForm.Button4Click(Sender: TObject);
begin
DataModule1.qSelectCustomers.SQL.Text := 'insert into Invoice (Name) values(:newName)';
DataModule1.qSelectCustomers.ParamByName('newName').AsString := 'test';
DataModule1.qSelectCustomers.ExecSQL;
BindSourceDB1.DataSet.Refresh;
////LinkFillControlToField1.BindList.FillList;
end;
我的问题是我收到的错误。
错误:= TFDQuery:不能在一个封闭的数据集执行此操作。
我试图打开设置反黑组,但没有去。
为什么会这样不行?
My problem is i am getting error. error:= TFDQuery : Can not perform this operation on a closed dataset. I have tried opening the dats set but no go. Why will this not work ?
推荐答案
您可以插入记录的数据集,像这样一个选择查询:
You can insert a record into a dataset with a select query like this:
DataModule1.qSelectCustomers.SQL.Text := 'SELECT * FROM Invoice';
DataModuel1.qSelectCustomers.Active := True;
DataModule1.qSelectCustomers.Append;
DataModule1.qSelectCustomers.FieldByName('Name').Value := 'test';
DataModule1.qSelectCustomers.Post;
这篇关于更新bindsource和ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文