PRB: Specifying View KeyField Sets Other Fields Updateable

This article was previously published under Q195408
This article has been archived. It is offered "as is" and will no longer be updated.
SYMPTOMS
Specifying the keyfield of a View sets the rest of the fields to beupdateable, although the fields are not being set to be updateableexplicitly.
RESOLUTION
Use a DBSETPROP() command similar to the following to clear the fields inthe view that you do not want to be updateable:
   DBSETPROP("TstVw.Fld1","Field","Updatable",.F.)				
Also, you can open the view in the View Designer and clear the fields thatyou do not want to be updateable, from the Update Criteria tab.
STATUS
Microsoft is researching this behavior and will post new information herein the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION

Steps to Reproduce Behavior

Create and run a program with the following code:
   CLOSE DATA ALL   CREATE DATA TstDBC   CREATE TABLE Tbl1 (Fld1 c(10),Fld2 d, Fld3 n(4))   FOR i = 1 TO 4      INSERT INTO Tbl1 VALUES (STR(i),DATE(),1234)   ENDFOR   CREATE SQL VIEW TstVw AS SELECT * FROM Tbl1   USE TstVw   =DBSETPROP("TstVw.Fld1","Field","KeyField",.T.)   ? DBGETPROP("TstVw.Fld2","Field","Updatable")   ? DBGETPROP("TstVw.Fld3","Field","Updatable")				
If the table for which the view is being created has a primary key, thenthat field is set as the keyfield automatically when the view is created.The following code reproduces this behavior:
   CLOSE DATA ALL   CREATE DATA TstDBC   CREATE TABLE Tbl1 (fld1 c(10) PRIMARY KEY,fld2 d, fld3 n(4))   FOR i = 1 TO 4      INSERT INTO Tbl1 VALUES (STR(i),DATE(),1234)   ENDFOR   CREATE SQL VIEW TstVw AS SELECT * FROM tbl1   USE TstVw   ? DBGETPROP("TstVw.Fld2","Field","Updatable")   ? DBGETPROP("TstVw.Fld3","Field","Updatable")				
Note that both of the DBGETPROP() commands return .T., meaning that both ofthe fields are updateable.
Properties

Article ID: 195408 - Last Review: 02/21/2014 00:30:46 - Revision: 2.1

  • 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
  • Microsoft Visual FoxPro 3.0b for Macintosh
  • kbnosurvey kbarchive kbdatabase kbpending kbprb KB195408
Feedback