Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Key field not updating.
Message
De
15/03/2003 21:12:44
 
 
À
05/03/2003 23:08:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00761947
Message ID:
00766252
Vues:
17
Hi Ken,

There is a problem in VFP7 - if field value is not assigned explicitly (default value), it is not sent to the backend. It doesn't really matter whether field is a key field. The following code illustrates the problem:

SET SAFETY OFF
CLOSE DATABASES all
clear
IF FILE("foo.dbc")
DELETE DATABASE foo DELETETABLES
ENDIF

CREATE DATABASE foo
CREATE TABLE foo (f1 I, f2 c(10))

CREATE SQL VIEW test as select * from foo

ThisView="test"
DBSetProp(ThisView,"View","SendUpdates",.T.)
DBSetProp(ThisView,"View","Tables","foo!foo")
DBSetProp(ThisView,"View","WhereType",2)

DBSetProp(ThisView+".f1","Field","DefaultValue","100")
DBSetProp(ThisView+".f1","Field","UpdateName","foo!foo.f1")
DBSetProp(ThisView+".f1","Field","KeyField",.T.)
DBSetProp(ThisView+".f1","Field","Updatable",.T.)

DBSetProp(ThisView+".f2","Field","UpdateName","foo!foo.f2")
DBSetProp(ThisView+".f2","Field","KeyField",.F.)
DBSetProp(ThisView+".f2","Field","Updatable",.T.)

CLOSE TABLES all
USE foo
USE test IN 0
INSERT INTO test (f2) values("100")
SELECT test
?GETFLDSTATE(-1)
TABLEUPDATE(.F.)
*list
SELECT foo
list


This problem has been fixed in VFP8.

Thanks,
Aleksey Tsingauz.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform