Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not updating data in backend
Message
 
 
À
10/09/2002 12:55:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00698878
Message ID:
00699418
Vues:
15
This message has been marked as the solution to the initial question of the thread.
Here is a procedure that I call to make a cursor updatable. tcCursor is the name of the cursor, and tcTable is the name of the source table to be updated.
   PROCEDURE MakeUpdatable
      LPARAMETERS tcCursor, tcTable
      IF VARTYPE(tcCursor) <> 'C'
         RETURN .f.
      ENDIF
      IF VARTYPE(tcTable) <> 'C'
         RETURN .f.
      ENDIF
      IF NOT USED(tcCursor)
         RETURN .f.
      ENDIF
      CURSORSETPROP('Tables', tcTable)
      ** The next property must include every remote field matched with the
      ** view cursor field.
      LOCAL lcFields, lcUpdate, llRetVal
      lcFields = ''
      lcUpdate = ''
      FOR lnI = 1 TO FCOUNT(tcCursor)
         IF NOT EMPTY(lcFields)
            lcFields = lcFields + ', '
         ENDIF
         lcFields = lcFields + FIELD(lnI, tcCursor) ;
                  + ' ' + tcTable + '.' + FIELD(lnI, tcCursor)
         IF UPPER(FIELD(lnI, tcCursor)) == 'KEYID'
            LOOP
         ENDIF
         IF NOT EMPTY(lcUpdate)
            lcUpdate = lcUpdate + ', '
         ENDIF
         lcUpdate = lcUpdate + FIELD(lnI, tcCursor)
      ENDFOR
      llRetVal = CURSORSETPROP('UpdateNameList', lcFields, tcCursor)
      llRetVal = CURSORSETPROP('KeyFieldList', 'KeyID', tcCursor)
      ** The next property specifies which fields can be updated.
      llRetVal = CURSORSETPROP('UpdatableFieldList', lcUpdate, tcCursor)
      ** The next property enables you to send updates.
      llRetVal = CURSORSETPROP('SendUpdates', .T., tcCursor)
      llRetVal = CURSORSETPROP('UpdateType', 1, tcCursor)
      llRetVal = CURSORSETPROP('WhereType', 3, tcCursor)
      RETURN llRetVal
   ENDPROC
>
>* Tables, KeyFieldList, UpdateNameList, UpdatableFieldList, and SendUpdates
>cursorsetprop("Buffering",5)
>cursorsetprop("Tables","test")
>cursorsetprop("KeyFieldList","item_id","test")
>cursorsetprop("UpdateNameList","itemdesc","test")
>cursorsetprop("UpdatableFieldList","itemdesc",'test')
>cursorsetprop("SendUpdates",.t.)
>
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform