Subject | TIB_Cursor edits |
---|---|
Author | peter@cyionics.com |
Post date | 2003-08-14T10:14:44Z |
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]
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]