Subject | Re: [IBO] 'Divide by Zero' & Locate the n'th row |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-02-26T02:27:17Z |
At 05:16 PM 25-02-02 -0800, you wrote:
statement. Can't you just test the input field where the divisor is entered?
If you need to wait until the database raises the exception, then trap the
error in the OnError event of the dataset or, better, of the session. You
are looking for errorcodes isc_exception_float_divide_by_zero and
isc_exception_integer_divide_by_zero in ErrorCodes array of the
EIB_ISCError (or EIBO_ISCError if you are using TIBO*).
There is a TI sheet on the TechInfo page on the topic of exception handling.
In native IBO (TIB_*) you can get it very safely using the Fields.ByName()
method.
However, FieldByName() will get it for you in either case. You will need
to use an As... casting to bring them into variables.
It's rarely recommended to locate specific rows by RowNum, especially in
joined sets. Make certain your KeyLinks are perfect with joined sets and
you should be able to avoid problems identifying a specific row in your
dataset.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>I use Dephi 5 enterprise,..don't understand this...
>IBobjects <----- which components?
>and Interbase <------ which version?
> and have a couple of problems.
>
>1) How can I trap a 'Divide by zero' error after it
>has happened. The program allows users to enter
>freeform calculations which it turns into 'before
>write' triggers
>therefore it is too difficult toIt would be better to trap a zero divisor before it goes out in a
>calculate all dividing numbers and test them for zero.
statement. Can't you just test the input field where the divisor is entered?
If you need to wait until the database raises the exception, then trap the
error in the OnError event of the dataset or, better, of the session. You
are looking for errorcodes isc_exception_float_divide_by_zero and
isc_exception_integer_divide_by_zero in ErrorCodes array of the
EIB_ISCError (or EIBO_ISCError if you are using TIBO*).
There is a TI sheet on the TechInfo page on the topic of exception handling.
>2) a: How do I obtain row from a joined set when IDepends (in some situations) on whether you are using TIB_* or TIBO*.
>only know the row number.
>b: Once the query has the row how do I pass three
>of the fields back to Delphi.
In native IBO (TIB_*) you can get it very safely using the Fields.ByName()
method.
However, FieldByName() will get it for you in either case. You will need
to use an As... casting to bring them into variables.
It's rarely recommended to locate specific rows by RowNum, especially in
joined sets. Make certain your KeyLinks are perfect with joined sets and
you should be able to avoid problems identifying a specific row in your
dataset.
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com