Subject | Re: [IBO] TIB_Cursor edits |
---|---|
Author | peter@cyionics.com |
Post date | 2003-08-14T11:37:52Z |
Thanks Helen
Thats very good of you.
I had a feeling I'd messed it up and I wasn't really happen with the code.
Looking forward to your reply.
Thanks
Peter
Thats very good of you.
I had a feeling I'd messed it up and I wasn't really happen with the code.
Looking forward to your reply.
Thanks
Peter
----- Original Message -----
From: Helen Borrie
To: IBObjects@yahoogroups.com
Sent: Thursday, August 14, 2003 12:32 PM
Subject: Re: [IBO] TIB_Cursor edits
Peter,
I spent 20 minutes trying to point out the stuff that was wrong with
this. It's such a muddle that I'm now starting again. In this message, I
will just tell you that the reason the "field" CLERK_ID wasn't found is
that your function tried to assign a value to a *parameter* of that name,
but that *parameter* does not exist in the SQL statement.
But - so much is wrong with this that I think I will save myself from being
here all night if I just provide you with the *right* way to do this, along
with perhaps a bit of education about how datasets actually work. Hope
this is OK - I'm very pressured for time. Give me a few mins to prepare a
work-through for you.
Helen
At 11:14 AM 14/08/2003 +0100, you wrote:
>I am having some problems with more than one parameter.
>
>I am trying to mark a pin as reserved, the pin already being identified
>from a product type.
>I want to update several fields as part of the reservation procedure
>
>The search portion works fine
>
>My editSQL is
>
>UPDATE PINS
>SET
>STATUS = 1 ,
>STATUS_CHANGED = 'NOW' ,
>CLERK_ID = :CLERK_ID
>WHERE ID = :ID
>
>
>My select SQL is
>select * from PINS where PRODUCT_ID = :PRODUCT_ID AND STATUS = 0
>
>I get an EIB_StatementError saying that the field CLERK_ID is not found.
>If I run this SQL in Workbench it runs fine.
>
>I wonder if Anyone could help / comment
>Rgds
>
>Peter
>Cyionics
>
>
>
>Code below
>
>{!! Given a Product Type try to find an available Pin!!}
>Function Server.FindAvailablePin(ProductID : Integer) : Integer;
>begin
> // search for Pin
> With Pin_IB_Cursor do
> begin
> Close;
> Prepare;
> ParamByName('PRODUCT_ID').AsInteger := ProductID;
> First; // run query
> Result := FieldByName('ID').AsInteger;
> end;
>
> // end of Pin_IB_Cursor
> If (Result = 0) then memo1.Lines.add('Debug - zero result')
> else
> begin
> With Pin_IB_Cursor do
> begin
> // Try to edit and post
> Try
> Memo1.Lines.add('Attempting Edit :' + IntToStr(Result));
> prepare;
>
> ParamByName('PRODUCT_ID').AsInteger := ProductID;
> ParamByName('CLERK_ID').AsInteger := 11;
>
> edit;
> Post;
> except
> begin
> // Cancel ?
> Result := 0;
> Memo1.Lines.add('Debug - Reservation Error');
> end;
> // end of try Edit Postloop
> end;
> // end of with Pin_IB_Cursor do
> end;
>
> end;
>
>end;
>
>
>[Non-text portions of this message have been removed]
>
>
>
>___________________________________________________________________________
>IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
>___________________________________________________________________________
>http://www.ibobjects.com - your IBO community resource for Tech Info papers,
>keyword-searchable FAQ, community code contributions and more !
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Yahoo! Groups Sponsor
ADVERTISEMENT
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]