Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Cannot insert an empty row from a view into its base table
Hi there,
i have an error here that i never saw before. Here is some code:
==========================================
open data data\sqlgt
Create SQL View test Remote ;
Connection SQLGT Share ;
As Select f13id, f13fmid, tabName ;
From File13, Tabula ;
Where f13UnitID = tabID
=SetProperties("test")
Close All
Open Data data\sqlgt
use test
brow
Procedure SetProperties
LParameter cViewName
Use (cViewName) NoData
DBSetProp(cViewName +"." +Field(1), "Field", "Keyfield", .T.)
DBSetProp(cViewName, "View", "BatchUpdateCount", 100)
DBSetProp(cViewName, "View", "CompareMemo", .T.)
DBSetProp(cViewName, "View", "FetchAsNeeded", .F.)
DBSetProp(cViewName, "View", "FetchMemo", .T.)
DBSetProp(cViewName, "View", "FetchSize", -1)
DBSetProp(cViewName, "View", "MaxRecords", -1)
DBSetProp(cViewName, "View", "Prepared", .T.)
DBSetProp(cViewName, "View", "SendUpdates", .T.)
DBSetProp(cViewName, "View", "ShareConnection", .T.)
DBSetProp(cViewName, "View", "UpdateType", 1)
DBSetProp(cViewName, "View", "WhereType", 3)
DBSetProp(cViewName +"." +Field(1), "Field", "Updatable", .T.)
DBSetProp(cViewName +"." +Field(2), "Field", "Updatable", .T.)
DBSetProp(cViewName +"." +Field(3), "Field", "Updatable", .F.)
=========================================
When i run this, add a new entry in the browse window, add some valid data to f13id (PK) and f13fmid (FK) and shoot TableUpdate(.T., .T.), he shoots back with: Cannot insert an empty row from a view into its base table(s) (Error 1547)
I guess it has to do with the Tabula that i'm joining, but i could bet that there is no key field defined for Tabula nor is TabName updatable.
The same error occurs if tabName is updatable or if tabid (PK) is taken into the Fields list.
How can i create this view so that i can write back all changes to File13, but nothing to Tabula?
Best Regards
Joerg Karpa
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement