Questions tagged [tdataset]

tdataset is the base class for all dataset components. Defined in the DB.pas unit, it represents data in rows and columns.

55 questions
15
votes
1 answer

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…
Christopher Chase
  • 2,840
  • 6
  • 36
  • 57
14
votes
2 answers

Delphi XE2 Dataset field type TStringField does not support Unicode?

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…
There is no spoon
  • 1,775
  • 2
  • 22
  • 53
12
votes
3 answers

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…
Cary Jensen
  • 3,751
  • 3
  • 32
  • 55
8
votes
5 answers

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

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; ... procedure DoStuff; begin …
Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122
8
votes
1 answer

What dataset row appears in the top-most row of DBGrid when RowCount > VisibleRowCount without that first row of the grid being selected?

Is it possible to get the row number that is displayed from the underlying dataset in the top-most row of a DBGrid, without that top-most row being the currently selected row, when the number of records in the underlying dataset is greater than the…
Cary Jensen
  • 3,751
  • 3
  • 32
  • 55
7
votes
2 answers

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…
Andrej Kirejeŭ
  • 5,381
  • 2
  • 26
  • 31
6
votes
1 answer

How to implement IsFirstRecord and IsLastRecord?

I like to disable controls when it's pointless for the user to click on them. One special case is a set of custom menu buttons that emulate the first, prior, next and last buttons of a standard TDBNavigator. When the user clicks on the first button,…
Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
6
votes
1 answer

How can I find if a DataSet is the master in a master/detail relationship in Delphi?

I want to create a "Duplicate Record" action which when invoked, duplicates current record in any TDataSet descendant. How can I find out if the dataset is the master dataset of a master/detail relationship? With TClientDataSet it's rather easy, but…
iMan Biglari
  • 4,674
  • 1
  • 38
  • 83
4
votes
3 answers

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…
Jim McKeeth
  • 38,225
  • 23
  • 120
  • 194
4
votes
3 answers

Delphi - Change field to calculated field at runtime. Is this a good practice?

As in the question's title, I argue with a colleague about how calculated fields should be used. From my knowledge, calculated fields are created at runtime as in the François's answer on the question Adding a calculated field to a Query at run…
RBA
  • 12,337
  • 16
  • 79
  • 126
4
votes
9 answers

DataTable (like DataSet) component in Delphi

I am a Delphi developer and a C# Developer. C# has the DataTable class that supports random access to Rows. Is there a third-party TDataSet (Delphi) component that is like DataTable (C#)?
MajidTaheri
  • 3,813
  • 6
  • 28
  • 46
3
votes
4 answers

Delphi, what's the quickest record access method in a TcxGrid or TDataSet

I am using Delphi 2007 and the TcxGrid to show the contents of a file library. The database houses information about the type of file, name, path, and extension. In testing I am loading 1700 records into the grid through the TDataSet. I also make…
Tim
  • 1,549
  • 1
  • 20
  • 37
3
votes
2 answers

Derived TClientdataset; defining an always-run OnAfterPost

I'm deriving from TClientdataset and trying to define an 'always run' AfterPost event. I have tried assign my AfterPost event at the constructor, but the derived component does not seem to pick it up TMyClientDataset = class(TClientDataset) private …
JeffP
  • 539
  • 1
  • 5
  • 19
3
votes
4 answers

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…
William Leader
  • 814
  • 6
  • 20
3
votes
4 answers

Get name of table that TField is from

I'm using a TDataSet where the CommandText property is set to an SQL query. I have also made the following function which creates part of an SQL query based on the fields of TDataSet. It is however incomplete. As you can see I still need to get the…
Petter
  • 33
  • 1
  • 4
1
2 3 4