tdataset

Delphi: Canceling a TDataSet.Post in an OnBeforePost Event

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 t...

Check at TDataSet row against a filter string

I am using a DevExpress TdxMemData in memory TDataSet descendant. While it has Filtered: Boolean and Filter: String properties, it doesn't appear to actually do anything with them automatically, instead relying on the result of the OnFilterRecord event's Accept parameter. So what I am looking for is a way (maybe it is in TdxMemData o...

How do I declare a TField as nullable?

I'm setting up an ADO-based client dataset, and when I try to insert a null value into a TIntegerField, on Post I get Project raised exception class EDatabaseError with message 'Non-nullable column cannot be updated to Null'. I know I've seen a way to set a TField as nullable before, but I can't remember where or how. Does anyone know ...

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

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 CreateData...

Return no records if FIndKey results in False?

Using TDataSet.FindKey you can locate records. When it results in True the datasets cursor will be positioned on the found record. When it results in False the cursor is not moved. This results in the record data prior to FindKey being issued being displayed in data aware components. How can I code the result of FindKey to return an emp...

Database application using MVC paradigm

In classic Delphi database application we have a form, a set of data-aware visual controls connected to TDataSets via TDataSources. If one wants to design database application using MVC model, where to place TDataSet components? Should they stay on form and therefore be a part of View? Or should they be encapsulated inside some Model obj...

Best way to swap two records in TDataset Delphi?

New to delphi and database programming in general but am curious if there is a better way to swap records in a TDataset? I have read through some help and cant find any obvious methods. Currently I have a procedure implemented to move records down the dataset until they hit the Eof marker. However I am getting some odd errors when I get ...

Embed a TDataSet in a Form at Design Time

I am looking for a way to provide a ListSource to a TDBLookupComboBox in delphi without having an actual table on the database server to draw that list from. The DataField for the Combo Box is a 1 character field that contains a coded value such as 'A' = 'Drivers License', 'B' = 'Passport', 'C' = 'Library Card', etc. That is to say that ...