Subject [IBO] Re: using Tib_Query.Locate in inserting mode
Author rudi_josic
--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...>
wrote:
> Just a quick comment, do not use typecasting as you do. This is
dangerous
> and makes debugging very difficult.
>
> Jason Wharton
>

Hi Jason, thanks

Something like this:


procedure TFormaClientes.EditCedulaExit(Sender: TObject);
Var
Q : TIB_Cursor;
begin
with Query_Lista do
if State = dssInsert then
try
Q := TIB_Cursor.Create(self);
Q.IB_Connection := Dm.DB;
Q.SQL.Add('Select count(*) from "Clientes" where "Cedula" = '+
EditCedula.Field.Value);
try
Q.Open;
if Q.Fields[0].AsInteger = 1 then
begin
ShowMessage(Format(csExiste,['La Cédula','a','a']));
EditCedula.SetFocus;
EditCedula.SelectAll;
end
except
Abort;
end;
finally
FreeAndNil(Q);
End;
end;

is it posible that the abuse of using typecasting bring me the crash
of the sistem?

i'm getting some "Flash" errors (some times occurs and other times
not) and there is no reason (aparently, never occurs in step by step
degugging). those errors occurs fracuently when open or close dinamic
forms (inherited all). in the base forms i use a lot of typecasting,
it is posible that the seed of the problem is typecasting?


Best Regards.-
Rudi Josic.