Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating a view created with CREATE SQL VIEW
Message
From
04/05/1998 22:49:10
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00096867
Message ID:
00096925
Views:
13
>I'm trying to update a view created via code. Here is the code I am using to create this view:
>
>create view vSysRelations as ;
> select ;
> RELATIONS.REL_ID, ;
> TABLES.TBL_NAME as TABLE1, ;
> FIELDS.FLD_NAME as FIELD1, ;
> TABLES_A.TBL_NAME as TABLE2, ;
> FIELDS_A.FLD_NAME as FIELD2, ;
> RELATIONS.REL_PROCESSING, ;
> RELATIONS.REL_NOTE ;
> from 'DATA MAPPING!RELATIONS' ;
> inner join 'DATA MAPPING!SYSTEM' on RELATIONS.REL_SYSTEM1ID = SYSTEM.SYS_ID ;
> inner join 'DATA MAPPING!TABLES' on RELATIONS.REL_TABLE1ID = TABLES.TBL_ID ;
> inner join 'DATA MAPPING!FIELDS' on RELATIONS.REL_FIELD1ID = FIELDS.FLD_ID ;
> inner join 'DATA MAPPING!SYSTEM' SYSTEM_A on RELATIONS.REL_SYSTEM2ID = SYSTEM_A.SYS_ID ;
> inner join 'DATA MAPPING!TABLES' TABLES_A on RELATIONS.REL_TABLE2ID = TABLES_A.TBL_ID ;
> inner join 'DATA MAPPING!FIELDS' FIELDS_A on RELATIONS.REL_FIELD2ID = FIELDS_A.FLD_ID ;
> where RELATIONS.REL_SYSTEM1ID = ?nSystem1ID ;
> and RELATIONS.REL_SYSTEM2ID = ?nSystem2ID ;
> order by RELATIONS.REL_ID
>
>=dbsetprop('vSysRelations', 'View', 'Tables', 'DATA MAPPING!RELATIONS')
>=dbsetprop('vSysRelations', 'View', 'SendUpdates', .t.)
>=dbsetprop('vSysRelations.REL_NOTE', 'Field', 'Updatable', .t.)
>=dbsetprop('vSysRelations.REL_PROCESSING', 'Field', 'Updatable', .t.)
>
>
>I run this code and then open the view. I get a cursor with about 20 entries which is correct. Everything works fine until I change the value of either of the two updatable fields; REL_NOTE (a memo) or REL_PROCESSING (a logical). As soon as I change a value and try to move to the next record I get the following error:
>
>"No update tables are specified. Use the Tables property of the cursor."
>
>When I DISPLAY DATABASE, the Tables value for this view is "DATA MAPPING!RELATIONS", which is the only table I want updated.
>
>Any help would be greatly appreciated.

Leighton-
(Leighton is my younger brother's name, BTW)
THere are a few more things that you must do to make these fields updateable, most importantly, set the updatename property.

Rather than give you step by step and risk leaving something out, I'll tell you how to get what you need. Create a simple view in the view designer and set the update properties. Open your database exclusively and run gendbc on it. (gendbc is a program that ships with vfp that uses a specified database to create a program that can be used to create that database, including all contained tables and views. It can be found in vfp\tools\gendbc\). Model your DBSETPROP code after the code that gendbc created for your test view. Studying this code can be quite a learning experience.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform