Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Is this a bug with UPDATE
Tue, Nov 2 2021 8:01 AMPermanent Link

Michael Saunders

The table field name is ' Item' and the following SQL works OK

UPDATE "TabletInvoice" SET
"Qty" = :Qty
WHERE "TabletID" = :TabletID  AND "Item" = :Item

However if I do the following

UPDATE "TabletInvoice" SET
"Qty" = :Qty
WHERE "TabletID" = :TabletID  AND "Item" = :DuplicateItem

I get the error 'No update record found'

Is this a bug If not why

Thanks
Sun, Nov 7 2021 4:00 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

Michael

Can you start at the beginning and describe the steps that you are taking?

I am guessing that you are in the Servers Manager, selected a Server, then selected a database. Is this correct? Then you have selected a dataset and you are now viewing the UDPATE SQL which looks something like

UPDATE "StockCategories" SET
"ID" = :ID,
"Name" = :Name
WHERE "ID" = :Old_ID

Is this correct or am I completely missing the point?

Richard
Mon, Nov 8 2021 7:02 PMPermanent Link

Michael Saunders

You are correct. This is the code that references the UPDATE

      TabletInvoice.Params.Values['TabletID']:= TabletID;
      TabletInvoice.Params.Values['Item']:= Item;
      Database.LoadRows(TabletInvoice);

      TabletInvoice.Columns['Item'].SortDirection:=sdAscending;
      TabletInvoice.SortCaseInsensitive:=True;
      TabletInvoice.Sort;

      if TabletInvoice.Find(['Item'],[Item],False,True) then
        begin
         TabletInvoice.update;
         TabletInvoice.Columns['Qty'].AsInteger := TabletInvoice.Columns['Qty'].AsInteger + AddedQty;
         TabletInvoice.save;
         Database.Commit;
         Request.SendContent('Duplicate Item  updated');
        end
Mon, Nov 29 2021 6:28 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< However if I do the following

UPDATE "TabletInvoice" SET
"Qty" = :Qty
WHERE "TabletID" = :TabletID  AND "Item" = :DuplicateItem

I get the error 'No update record found' >>

EWB 3 requires that the parameter names match the names of the columns being updated (that's how EWB knows to populate the parameter).

Is there actually a column called "DuplicateItem" in the table being updated ?

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Dec 4 2021 5:34 AMPermanent Link

Michael Saunders


Is there actually a column called "DuplicateItem" in the table being updated ?

No there is not  What confused me is when I generate the UPDATE command automatically using the  IDE  eg

WHERE "Account" = :Old_Account

maybe should be

WHERE "Account" = :Account
Image