tdataset

Moving Columns in a DBGrid seems to move the attached DataSet fields

吃可爱长大的小学妹 提交于 2021-02-07 05:19:51
问题 I observed something last week that I did not expect, and will describe below. I am curious as to why this happens. Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else? The order of the fields in an open ClientDataSet changed. Specifically, I created a ClientDataSet in code by calling CreateDatatSet after defining its structure using FieldDefs. The first field in this ClientDataSet's structure was a Date field named StartOfWeek. Only moments later,

Moving Columns in a DBGrid seems to move the attached DataSet fields

回眸只為那壹抹淺笑 提交于 2021-02-07 05:18:12
问题 I observed something last week that I did not expect, and will describe below. I am curious as to why this happens. Is it something internal to the TDataSet class, an artifact of the TDBGrid, or something else? The order of the fields in an open ClientDataSet changed. Specifically, I created a ClientDataSet in code by calling CreateDatatSet after defining its structure using FieldDefs. The first field in this ClientDataSet's structure was a Date field named StartOfWeek. Only moments later,

How can I get a dataset of in-memory objects?

柔情痞子 提交于 2020-01-01 04:58:12
问题 Does anyone know of a TDataset descendant that works with Generics and RTTI, so that I can write code like this, and make use of data-aware components in the GUI? : ... ds:TDataset<TPerson>; ... procedure DoStuff; begin ds:=TDataset<TPerson>.create; ds.add(TPerson.Create('A.','Hitler',77)); ds.add(TPerson.Create('O.','Bin Laden',88)); end; This should be possible. The fielddefs can be created via RTTI because the exact type of the data is known. Values can also be automatically marshalled

Delphi: Canceling a TDataSet.Post in an OnBeforePost Event

拈花ヽ惹草 提交于 2019-12-19 05:10:28
问题 On our main data entry screen, we have an OK/Cancel dialog in the OnBeforePost event. OK lets things take their course Cancel right now does a Dataset.Cancel; Which does what it's meant to, roll back any changes and puts the dataset into browse mode. This is fine for most of the clients, but we have been asked if it can be changed to Cancel , Abort the Post and stay in edit mode with the current changes kept. If they want to cancel, they can use the cancel button. Looking at the source for

How can I get a dataset of in-memory objects?

青春壹個敷衍的年華 提交于 2019-12-03 12:51:46
Does anyone know of a TDataset descendant that works with Generics and RTTI, so that I can write code like this, and make use of data-aware components in the GUI? : ... ds:TDataset<TPerson>; ... procedure DoStuff; begin ds:=TDataset<TPerson>.create; ds.add(TPerson.Create('A.','Hitler',77)); ds.add(TPerson.Create('O.','Bin Laden',88)); end; This should be possible. The fielddefs can be created via RTTI because the exact type of the data is known. Values can also be automatically marshalled back and forth, so you can both view and edit data that's in a class or a record. I hate having to write a

Delphi XE2 Dataset field type TStringField does not support Unicode?

只愿长相守 提交于 2019-12-01 14:52:45
问题 I've been looking through the TDataset class and its string fields, in Delphi XE2 and noticed that AsWideString returns a type of UnicodeString. However it gets the value from the function TField.AsString: String which in turn calls TFIeld.AsAnsiString:AnsiString. Therefore any unicode characters would be lost? Also the buffer which is passed to TDataset.GetFieldData is declared as an array of AnsiChar. Am I understanding this correctly? 回答1: No, you should be examining the TWideStringField

Delphi: Canceling a TDataSet.Post in an OnBeforePost Event

好久不见. 提交于 2019-12-01 02:35:01
On our main data entry screen, we have an OK/Cancel dialog in the OnBeforePost event. OK lets things take their course Cancel right now does a Dataset.Cancel; Which does what it's meant to, roll back any changes and puts the dataset into browse mode. This is fine for most of the clients, but we have been asked if it can be changed to Cancel , Abort the Post and stay in edit mode with the current changes kept. If they want to cancel, they can use the cancel button. Looking at the source for procedure TDataSet.Post; it does not look possible to use the event this way. Dose anyone have any