Tutorial Chapter 11: Master/Detail / The Orders Program orders.4gl |
This function inserts a new record in the orders database table.
01 FUNCTION order_insert() 02 03 WHENEVER ERROR CONTINUE 04 INSERT INTO orders ( 05 store_num, 06 order_num, 07 order_date, 08 fac_code, 09 ship_instr, 10 promo 11 ) VALUES ( 12 order_rec.store_num, 13 order_rec.order_num, 14 order_rec.order_date, 15 order_rec.fac_code, 16 order_rec.ship_instr, 17 order_rec.promo 18 ) 19 WHENEVER ERROR STOP 20 21 IF (SQLCA.SQLCODE <> 0) THEN 22 CLEAR FORM 23 ERROR SQLERRMESSAGE 24 RETURN FALSE 25 END IF 27 28 MESSAGE "Order added" 29 RETURN TRUE 30 31 END FUNCTION