Problem with TField.Required

I use Oracle 8.0.4, Delphi 5 Enterprise Edition and DOA 3.4.3. In my
application I have a small table with two fields of type varchar2(20)
both not null with the first field as primary key.

The SQL for my TOracleDataSet is "select t.a, t.b, t.rowid from table
order by t.a" and I created persistent datafields.

Property Required is automatically set in my persistent fields. When a
user starts editing this table and leaves one field blank an exception
is raised shown in an ordinary messagebox. This messagebox is created by
TDataSet.CheckRequiredFields called from TDataSet.Post.

In the current project I use my own error handling with improved
messages and nicer messageboxes. I set Required to False to avoid the
standard messagebox, TOracleDataSet.OnPostError and
TOracleDataSet.OnTranslateMessage and got all I wanted.

Lately a user clicked the insert button, left both fields blank and
clicked the ok button. And what a surprise. Nothing happened. No error
message and a empty new row in my DBGrid! After a while of debugging and
using the OracleMonitor I recognized the reason. If both fields are
empty no SQL statement for an insert is generated! Though now I know the
reason, I don't know how to fix it. And I am not sure who is responsible
for this bug (if it is one). Does TDataSet a mistake or perhaps DOA? Or
did I forget to change any properties?

Hope anybody can help me.
 
If you insert a new record, its initial state is "empty". As long as no fields are modified, posting this record, or navigating to a different record, will simply cancel it. This is standard TDataSet behavior. At least one of the fields must have a non-null value.

------------------
Marco Kalter
Allround Automations
 
Back
Top