Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid problem
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Miscellaneous
Thread ID:
00618349
Message ID:
00618407
Views:
7
You do this everytime the form is launched??? Seeing any DBC/DCT bloat? Why not just create a cursor that is NOT part of the DBC, then use the following code to make the cursor updatable. Modify to suit your needs because all my tables have a PK field called KeyID. Also modify the WhereType and UpdateType to suit.
   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
      LOCAL lnSelect
      lnSelect = SELECT()
      SELECT (tcCursor)
      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' && PK field is not updatable
            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)
      SELECT (lnSelect)
      RETURN llRetVal
   ENDPROC
>I have been really frustrated by a grid class that I setup to allow editing of a local view. I am programmatically creating the view, setting the view and it's columns to updatable, running the custom grid class on a custom form class with recordsourcetype set to alias, then recordsource set to my cursorname.
>
>Here's the problem: I can run the code to create the view and all is well. I can open it manually, make changes and the changes are propagated to the original file.
>
>When I run the grid class, all appears to work, but no changes are made.
>
>I tested by creating a base-class grid on a form (no classes involved) and it updates the original file as well.
>
>There has to be a process error somewhere, but I can't seem to figure it out...
>
>any ideas would be greatly appreciated!
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform