Subject Re: [IBO] Fetching Query Results......
Author Marc Leclerc
Hi Geoff, I do have a few question if you don't mind.

> Your functions make it look like the user (or something) is provding a
> company id to the edit/insert procedures. In which case I would do
> something like...

Yes it's called from the mainform which has a read-only query from which I
get the number.

>
> ...EditExistingCompany(CompanyID: integer): integer;
> begin
> with IB_QueryCompany do
> try
> if not Prepared then
> Prepare;
> ParamByName('C_ID').AsInteger := CompanyID;
> First;
> Edit;
> Result := ShowModal;
> <etc>
>

This works, as I can see calling first opens the query ?, is there any
advantages vs open;

> ...CreateNewCompany(): integer;
> begin
> with IB_QueryCompany do
> try
> if not Prepared then
> Prepare;
>
> Insert; // notice there is no param assignment
> // you do not need to open a query to insert.
> {$IFDEF _CDS_}
> CBCreateOffice.Visible := True;
> CBCreateOffice.Checked := True;
> {$ENDIF}
> Append;
> Result := ShowModal;
> <etc>

this actually crashed, since I still have to call OpenDataset to open all
lookups tables. calling insert does not set the query to active and when my
loop to open goes through it call open... I though there would not be much
penality to open with param = -1 since there should be no row fetched from
the server.

Thanks
>
>
> I think the above should work. Does it acheive what you want?
>
>
> Geoff Worboys
> Telesis Computing
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>