Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to come up with a view/CA model
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01410693
Message ID:
01410905
Vues:
44
WOW! What a post :o))))))))))))
In my 22" wide screen monitor it didn't fit :-)))))))

Which field is AUTOINC?
Just remove it from UpdateNameList.

>>Two things:
>>Put OptionsId also in JOIN condition (I didn't see it)
>>Use [_1_12_] pattern because when you want ModelId 1 you will get ALL that have [1] in the number 1, 10,11..19,21 etc.
>
>Hi Boris,
>
>I'm trying this idea, but if my PK field is NULL (because I don't have these records in the table yet), tableupdate returns .t., but new records are not inserted. Do you know what should I do? The PK field is Auto-increment in the table.
>
>Bellow is CA code - am I missing something here?
>
>
>DEFINE CLASS cadealeropts AS cursoradapter_
>
>
>	SelectCmd = "select DealerOpts.OptsID, NVL(DealerOpts.OptionID,?getOptionID) as OptionID,  NVL(DealerOpts.MakeID, "+;
                           "?getMakeID) as MakeID, Models.ModelID as ModelID, Models.MfgName, Models.Name as ModelName, "+;
                           "Models.ModelNmbr as ModelNmbr,  Models.ModelYear as ModelYear, DealerOpts.Retail, DealerOpts.Cost, "+;
                           "DealerOpts.Costline, DealerOpts.Type as cType, DealerOpts.StdOption from DealerOpts "+
                           "RIGHT JOIN Models ON DealerOpts.ModelID = Models.ModelID and DealerOpts.OptionID = ?getOptionID and "+;
                                                  "DealerOpts.MakeID = ?getMakeID where cast(Models.ModelID as varchar(12)) $ (?getModelIDs)"
>	CursorSchema = "OptsID I, OptionID I, MakeID I, ModelID I, MfgName C(40), ModelName C(65), "+;
                                 "ModelNmbr C(20), ModelYear C(40), Retail N(10, 2), Cost N(10, 2), Costline N(10, 2),"+;
                                 " cType C(12), StdOption L(1)"
>	Alias = "curdealeropts"
>	DataSourceType = "Native"
>	Flags = 0
>	CompareMemo = .T.
>	FetchMemo = .F.
>	SendUpdates = .T.
>	KeyFieldList = "OPTSID"
>	Tables = "DealerOpts,Models"
>	UpdatableFieldList = "OPTSID, OPTIONID, MAKEID, MODELID, RETAIL, COST, COSTLINE, CTYPE, STDOPTION"
>	UpdateNameList = "OPTSID DealerOpts.OPTSID, OPTIONID DealerOpts.OPTIONID, MAKEID DealerOpts.MAKEID, :+;
                         "MODELIDDealerOpts.MODELID, RETAIL DealerOpts.RETAIL, COST DealerOpts.COST, "+;
                         "COSTLINE DealerOpts.COSTLINE, CTYPE DealerOpts.Type, STDOPTION DealerOpts.STDOPTION"
>	BreakOnError = .T.
>	UseCursorSchema = .T.
>	UseTransactions = .T.
>	Name = "cadealeropts"
>
>
>	PROCEDURE AutoOpen
>		*** Setup code: DO NOT REMOVE
>		if not pemstatus(This, '__VFPSetup', 5)
>			This.AddProperty('__VFPSetup', 1)
>			This.Init()
>		endif
>		*** End of Setup code: DO NOT REMOVE
>	ENDPROC
>
>
>	PROCEDURE Init
>		*** Setup code: DO NOT REMOVE
>		local llReturn
>		do case
>			case not pemstatus(This, '__VFPSetup', 5)
>				This.AddProperty('__VFPSetup', 0)
>			case This.__VFPSetup = 1
>				This.__VFPSetup = 2
>			case This.__VFPSetup = 2
>				This.__VFPSetup = 0
>				return
>		endcase
>		set multilocks on
>		llReturn = dodefault()
>		*** End of Setup code: DO NOT REMOVE
>		*** Select connection code: DO NOT REMOVE
>
>		local lcDBC
>		lcDBC = 'W:\SSS\SMNA\DATA\MNA.DBC'
>		if dbused(lcDBC)
>			set database to (lcDBC)
>		else
>			open database (lcDBC)
>		endif
>		*** End of Select connection code: DO NOT REMOVE
>
>		*** Setup code: DO NOT REMOVE
>		if This.__VFPSetup = 1
>			This.__VFPSetup = 2
>		endif
>		return llReturn
>		*** End of Setup code: DO NOT REMOVE
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: cadealeropts
>**************************************************
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform