Hi there, I would like you to help me solve this, please:

What I need is that when the same products are added, that new ones are not added, but rather that they are added. I am using SQLite 3.
This is the code I have to enter products by barcode:
Thanks.
-----
I don't speak English, I used Google Translate.
What I need is that when the same products are added, that new ones are not added, but rather that they are added. I am using SQLite 3.
This is the code I have to enter products by barcode:
Code:
b = Input.GetText("barcode"); if b > "1000000" and b <= "9999999" then for row in db:nrows("SELECT * FROM Products where Code="..b.."") do if b == (row.Code) then Input.SetText("barcode", ""); Page.SetFocus("barcode") nRowID = Grid.InsertRow("GridSales", -1, false); Grid.SetCellText("GridSales", nRowID, 0, row.Code, false); Grid.SetCellText("GridSales", nRowID, 1, row.Name, false); Grid.SetCellText("GridSales", nRowID, 2, row.SalePrice, false); Grid.SetCellText("GridSales", nRowID, 3, "1", false); Grid.SetCellText("GridSales", nRowID, 4, "0", false); --Column 2 * Column 3 = Column 4 value = Grid.GetCellText("GridSales", nRowID, 2); amount = Grid.GetCellText("GridSales", nRowID, 3); multiplication = value * amount; Grid.SetCellText("GridSales", nRowID, 4, multiplication, true); --Column 4 (Sum) cell_value = 0; for x = 1, Grid.GetRowCount ("GridSales")-1 do if Grid.GetCellText ("GridSales", x, 4) ~= "" and String.ToNumber(Grid.GetCellText ("GridSales", x, 4)) ~= 0 then cell_value = cell_value + String.ToNumber (Grid.GetCellText ("GridSales", x, 4)) end end Input.SetText("total", Math.Round(cell_value, false)); --************************************************** ******************************** Grid.SetEnabled("GridSales", true); Grid.Refresh("GridVentas"); --************************************************** ******************************* end end end
-----
I don't speak English, I used Google Translate.
Comment