Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't update the input data finto the TABLE
Message
De
29/11/1999 05:32:30
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
29/11/1999 04:50:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00296296
Message ID:
00296306
Vues:
27
>I design order entry form to accept the input data. But
>I have a problem in update the delete/insert record(s) into the table after close the windows/or through a EXIT FUNCTION
>Is this any coding error in this two INSERT and DELETE functions.
>Please help me to solve problem a.s.a.p.
>
>The following is the coding of the INSERT FUNCTION
>
>SELECT ODETAIL
>lcOldTalk = SET("TALK")
>SET TALK OFF
>lcOldDeleted = SET("DELETED")
>SET DELETED OFF
>** Insert new record
>APPEND BLANK
>REPLACE odetail.orderno WITH Order.OrderNo IN odetail
>*REPLACE order_id with lMaxID in orders
>** Restore talk setting
>SET TALK &lcOldTalk
>SET DELETED &lcOldDeleted
>SELECT ORDER
>THISFORM.Refresh
>
>**end of INSERT FUNCTION
>
>The following is the coding of the DELETE FUNCTION
>
>#DEFINE MSGBOX_YES 6
>#DEFINE C_MSGBOX1 36
>#DEFINE C_DELETE1_LOC "Are you sure you want to delete the order number "
>#DEFINE C_DELETE2_LOC "?"
>lcMessage = C_DELETE1_LOC + ALLTRIM(ODetail.OrderNo) +ALLTRIM(ODetail.StockNo)+ C_DELETE2_LOC
>lcOrderID = Order.OrderNo
>IF MESSAGEBOX(lcMessage,C_MSGBOX1) = MSGBOX_YES
>SELECT ODETAIL
>DELETE
>IF !EOF()
>SKIP 1
>ENDIF
>IF EOF() AND !BOF()
>SKIP -1
>ENDIF
>THISFORM.Refresh
>ENDIF
>
>**END OF DELETE FUNCTION
>
>Waiting for any advice.
>Many thanks for any assistance.
>
>Dennis


I don't know why you set talk on/&oldtalk per insertion. Anyway this would be how I code them :

* Insert routine
insert into oDetail ;
(orderno) values (order.orderno)
THISFORM.Refresh

* Delete routine
#DEFINE MSGBOX_YES 6
#DEFINE C_MSGBOX1 36
#DEFINE C_DELETE1_LOC "Are you sure you want to delete the order number "
#DEFINE C_DELETE2_LOC "?"
lcMessage = C_DELETE1_LOC + ALLTRIM(ODetail.OrderNo) +ALLTRIM(ODetail.StockNo)+ C_DELETE2_LOC
lcOrderID = Order.OrderNo
IF MESSAGEBOX(lcMessage,C_MSGBOX1) = MSGBOX_YES
SELECT ODETAIL
lnRec = recno()
DELETE
locate for !deleted() while !eof()
if eof()
go lnRec
lcOrder = order()
llDescending = descending()
if !empty(lcOrder)
lcDescending = iif( llDescending, "ascending", "descending" )
set order to tag (lcOrder) &lcDescending && Reverse order
locate for !deleted() while !eof()
set order to tag (lcOrder)
if eof()
locate
endif
else
do while !bof() and deleted()
skip -1
enddo
endif
endif
endif
THISFORM.RefreshBut I didn't see any tableupdate() there and don't know if you use any buffering. If you do you should have a tableupdate().
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform