Subject | Two questions |
---|---|
Author | Salvatore Besso |
Post date | 2003-03-21T12:00:19Z |
hello again,
I have two questions:
I have used a number of TIB_Edit's and a number of linked TIB_Label's
in my form. I was wondering why only the TIB_Label associated with the
first TIB_Edit (tab order 0) is shown with a bold font and is
truncated. I have not set any font properties for all the labels and
all their ParentFont is True.
The second question is again about error handling. I have set up an
OnError handler to manage the error conditions. When a not nullable
field is left NULL an SQL error -625 is thrown and I can loop through
the dataset Fields[X] property to find a field that has its IsNull
property true, and that's ok. But if another field violates a check
constraint, for example it is defined to be > 0 and I left a zero
value, the SQL code is the same: -625 (validation error). Is there any
way in Delphi code to distinguish between these two (or more) cases?
An example:
case SQLCODE of
-625: begin // validation error
D := Sender as TIB_Dataset;
for I := 0 to Pred(D.Fields.ColumnCount) do
begin
if D.Fields[I].IsNull then // ok for NULL fields
begin
D.Fields[I].FocusControl;
Msg := Format(SEvtCannotSave, [D.Fields[I].DisplayName]);
Break
end
else if ???? // what for fields that violate check constraints?
[snip]
Regards
Salvatore
I have two questions:
I have used a number of TIB_Edit's and a number of linked TIB_Label's
in my form. I was wondering why only the TIB_Label associated with the
first TIB_Edit (tab order 0) is shown with a bold font and is
truncated. I have not set any font properties for all the labels and
all their ParentFont is True.
The second question is again about error handling. I have set up an
OnError handler to manage the error conditions. When a not nullable
field is left NULL an SQL error -625 is thrown and I can loop through
the dataset Fields[X] property to find a field that has its IsNull
property true, and that's ok. But if another field violates a check
constraint, for example it is defined to be > 0 and I left a zero
value, the SQL code is the same: -625 (validation error). Is there any
way in Delphi code to distinguish between these two (or more) cases?
An example:
case SQLCODE of
-625: begin // validation error
D := Sender as TIB_Dataset;
for I := 0 to Pred(D.Fields.ColumnCount) do
begin
if D.Fields[I].IsNull then // ok for NULL fields
begin
D.Fields[I].FocusControl;
Msg := Format(SEvtCannotSave, [D.Fields[I].DisplayName]);
Break
end
else if ???? // what for fields that violate check constraints?
[snip]
Regards
Salvatore