to apply updates automatically, just "BindSourceDB1.Datasource.AutoEdit=true" as normal Dataset!
then, when moving to next record, for example, the post will be done! the rest, you need works with "TRANSACTION" (automatically or manual), then, you can "COMMIT" or not when you need.
For example, in FDConnection you have "TxOptions.AutoCommit = true/false.. AutoStart...AutoStop... etc..."
I think that it's a error "your", using "ComboEditOnChange" to "close/open" a Query all time! I dont want to talk about your use of "While... EOF" to fill it"
it's not necessary use "While EOF" (old times...) to fill the combobox! Just bind this component with a field in your table! this is right way!
if you need a "filter" in your record, you can have another Query with a SQL select to filter your record! Ex; Select distincts Names from MyTable
if you need all time have a "FORM" to show your data, you dont need "CLOSE/KILL it"...."CREATE" you can just "HIDE it", then, it always will be ready to use, include you dont need remove your "livebind links", because the form is "hide". you see me?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
// CHANGE THIS.... AForm.DisposeOf; //linux不能用freeandnil AForm:=nil; AForm:=TFMShowBalance.Create(self); AForm.ShowModal; ---------- // USE THIS ... AForm.HIDE;
... AForm.Show/ShowModal;
when you need close your app, or table or DB, then, "AForm.Free" just one time!
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
您的数据搞砸了,可能是因为您在表单的相同组件中使用了“LiveBinding”和“WHILE TB.EOF”。
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
楼上所言极是,再次证明如果出现错误,99.99%不能怪delphi 问题发生在comboedit的onchange事件里,改成这样就正常了 procedure TFrSystemSet.ComboBox2Enter(Sender: TObject); begin FDQYear.Refresh; ComboBox2.Items.Clear; FDQYear.First; while not FDQYear.Eof do begin ComboBox2.Items.Add(FDQYear.FieldByName('year').AsString); FDQYear.Next; end; ComboBox2.DropDownKind := TDropDownKind.Custom; //改变下拉字体大小 for var I := 0 to ComboBox2.Items.Count-1 do begin ComboBox2.ListBox.ListItems[i].StyledSettings:=[]; ComboBox2.ListBox.ListItems[i].TextSettings.Font.Size := 14; ComboBox2.ListBox.ListItems[i].Height := 25; end; end;
----------------------------------------------
-
I think the colleague is making basic mistakes, mixing current techniques with old programming methods! But the choice is his, not mine. So I'll shut up this time!
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3