PRB: Null RuleExpression, RuleText, and Default View Properties (179298)
The information in this article applies to:
- Microsoft Visual FoxPro for Macintosh 3.0b
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q179298 SYMPTOMS
The following error message is returned when you attempt to use a view:
Error reading a property from the database. The property is ignored.
CAUSE
Setting the RuleExpression, RuleText, and/or the Default property of a view
field to an illegal value causes this behavior. Examples of illegal values
include the null string ("") or setting a RuleExpression property to a text
string, such as "This field cannot be empty."
RESOLUTION
In order to prevent the error message from appearing it is necessary to re-
create the view with valid field properties.
The following code re-creates a view from the view definition stored in the
database container:
PARAMETER viewname
thisversion=VERSION()
IF LEFT(ALLTRIM(thisversion),6)="Visual"
thisversion=VAL(SUBSTR(thisversion,15,2))
ELSE
thisversion=0
ENDIF
SET EXCLUSIVE ON
SET MULTILOCKS ON
DECLARE viewprops[1,5]
OPEN DATABASE home()+"\SAMPLES\DATA\TESTDATA" EXCL
sql_statement=DBGETPROP(viewname,"VIEW","SQL")
llsendupdates=DBGETPROP(viewname,'View','SendUpdates')
lnupdatetype=DBGETPROP(viewname,'View','UpdateType')
lnwheretype=DBGETPROP(viewname,'View','WhereType')
lnbatchupdatecount=DBGETPROP(viewname,'View','BatchUpdateCount')
lnusememosize=DBGETPROP(viewname,'View','UseMemoSize')
lnfetchsize=DBGETPROP(viewname,'View','FetchSize')
llfetchmemo=DBGETPROP(viewname,'View','FetchMemo')
lnmaxrecords=DBGETPROP(viewname,'View','MaxRecords')
lctables=DBGETPROP(viewname,'View','Tables')
lccomment=DBGETPROP(viewname,'View','Comment')
IF thisversion>=5
llprepared=DBGETPROP(viewname,'View','Prepared')
llcomparememo=DBGETPROP(viewname,'View','CompareMemo')
llfetchasneeded=DBGETPROP(viewname,'View','FetchAsNeeded')
ENDIF
USE &viewname
=AFIELDS(viewflds,viewname)
USE
FOR i=1 TO ALEN(viewflds,1)
DIMENSION viewprops[i,5]
fld_name=viewflds[i,1]
viewfield=ALLTRIM(viewname)+"."+ALLTRIM(fld_name)
viewprops[i,1]=DBGETPROP(viewfield,'Field','KeyField')
viewprops[i,2]=DBGETPROP(viewfield,'Field','Updatable')
viewprops[i,3]=DBGETPROP(viewfield,'Field','UpdateName')
viewprops[i,4]=DBGETPROP(viewfield,'Field','DataType')
viewprops[i,5]=DBGETPROP(viewfield,'Field','Caption')
NEXT
DELETE VIEW &viewname
CREATE SQL VIEW &viewname AS &sql_statement
=DBSETPROP(viewname,'View','SendUpdates',llsendupdates)
=DBSETPROP(viewname,'View','UpdateType',lnupdatetype)
=DBSETPROP(viewname,'View','WhereType',lnwheretype)
=DBSETPROP(viewname,'View','BatchUpdateCount',lnbatchupdatecount)
=DBSETPROP(viewname,'View','UseMemoSize',lnusememosize)
=DBSETPROP(viewname,'View','FetchSize',lnfetchsize)
=DBSETPROP(viewname,'View','FetchMemo',llfetchmemo)
=DBSETPROP(viewname,'View','MaxRecords',lnmaxrecords)
=DBSETPROP(viewname,'View','Tables',lctables)
=DBSETPROP(viewname,'View','Comment',lccomment)
IF thisversion>=5
=DBSETPROP(viewname,'View','Prepared',llprepared)
=DBSETPROP(viewname,'View','CompareMemo',llcomparememo)
=DBSETPROP(viewname,'View','FetchAsNeeded',llfetchasneeded)
ENDIF
FOR i=1 TO ALEN(viewflds,1)
fld_name=viewflds[i,1]
viewfield=ALLTRIM(viewname)+"."+ALLTRIM(fld_name)
=DBSETPROP(viewfield,'Field','KeyField',viewprops[i,1])
=DBSETPROP(viewfield,'Field','Updatable',viewprops[i,2])
=DBSETPROP(viewfield,'Field','UpdateName',viewprops[i,3])
=DBSETPROP(viewfield,'Field','DataType',viewprops[i,4])
=DBSETPROP(viewfield,'Field','Caption',viewprops[i,5])
NEXT
RETURN
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 5/10/2003 |
---|
Keywords: | kbprb KB179298 kbAudDeveloper |
---|
|