Microsoft KB Archive/249836

From BetaArchive Wiki

Article ID: 249836

Article Last Modified on 5/12/2003



APPLIES TO

  • Microsoft Visual FoxPro 3.0b for Macintosh
  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a
  • Microsoft Visual FoxPro 6.0 Professional Edition



This article was previously published under Q249836

SYMPTOMS

The following error message appears when issuing a REQUERY() command against a remote view:

Table buffer for alias <view name> contains uncommitted changes

CAUSE

This behavior occurs when a REQUERY() command is issued against a remote view under the following conditions:

  • Optimistic Table Buffering has been enabled.
  • Changes have been made to one or more rows in the view.
  • A TABLEUPDATE() or TABLEREVERT() command has not been issued.


RESOLUTION

Issue a TABLEUPDATE() or TABLEREVERT() command before issuing a REQUERY() command.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a program file named "BUFFDEMO" using the following code:

    CREATE TABLE test (Charfld c(10), Numfld N(10,4))
    CLOSE ALL
    
    CREATE DATA test
    CREATE CONNECTION testa CONNSTRING 'DRIVER=Microsoft Visual FoxPro Driver;' + ;
       'exclusive=no;SourceType=DBF;SourceDB='+SYS(5)+SYS(2003)
    
    ON ERROR DO errordemo IN buffdemo WITH MESSAGE()
    
    CREATE SQL VIEW myview CONNECTION testa ;
       AS SELECT * FROM test
    
    *Set View Properties
    DBSETPROP('MyView','View','SendUpdates',.T.)
    DBSETPROP('MyView','View','UpdateType',1)
    DBSETPROP('MyView','View','WhereType',3)
    DBSETPROP('MyView','View','BatchUpdateCount',1)
    DBSETPROP('MyView','View','UseMemoSize',255)
    DBSETPROP('MyView','View','FetchSize',100)
    DBSETPROP('MyView','View','MaxRecords',-1)
    DBSETPROP('MyView','View','Tables','test')
    DBSETPROP('MyView','View','Prepared',.F.)
    DBSETPROP('MyView','View','FetchMemo',.F.)
    DBSETPROP('MyView','View','CompareMemo',.F.)
    DBSETPROP('MyView','View','FetchAsNeeded',.F.)
    DBSETPROP('MyView','View','FetchSize',100)
    DBSETPROP('MyView','View','Comment',"")
    *DBSETPROP('MyView','View','ShareConnection',.T.)
    * Set Key and Updateable fields.
    DBSETPROP('MyView.Charfld','Field','KeyField',.T.)
    DBSETPROP('MyView.Charfld','Field','Updatable',.T.)
    DBSETPROP('MyView.Charfld','Field','UpdateName','test.charfld')
    DBSETPROP('MyView.Charfld','Field','DataType',"C(10)")
    DBSETPROP('MyView.Numfld','Field','KeyField',.F.)
    DBSETPROP('MyView.Numfld','Field','Updatable',.T.)
    DBSETPROP('MyView.Numfld','Field','UpdateName','test.numfld')
    DBSETPROP('MyView.Numfld','Field','DataType',"N(10,4)")
    
    SET MULTILOCKS ON
    
    USE myview
    =CURSORSETPROP('buffering',5)
    INSERT INTO myview VALUES ("test",1)
    *!* TABLEUPDATE(.T.)
    =REQUERY('myview')
    BROW
    ON ERROR
    CLOSE ALL
    
    PROCEDURE errordemo
    PARAMETER whatfailed
    messagebox(whatfailed,16+0,"Error")
    =TABLEREVERT(.T.)
                        
  2. Run the program file.
  3. Note the message displayed in the message box.
  4. Uncomment the TABLEUPDATE(.t.) command in BUFFDEMO.prg.
  5. Run the program file.
  6. Note that the remote view is updated and no error message appears.


REFERENCES

For additional Information, query the Visual FoxPro product documentation for the following topics:

  • Buffered Updates (defined)
  • REQUERY()
  • TABLEUPDATE()
  • TABLEREVERT()

(c) Microsoft Corporation 2000, All Rights Reserved. Contributions by John Desch, Microsoft Corporation.



Additional query words: VIEW

Keywords: kbdatabase kbprb KB249836