Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating a View Primary Key
Message
De
30/01/2006 17:49:12
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01089683
Message ID:
01091670
Vues:
37
This message has been marked as the solution to the initial question of the thread.
>>>>You could use REFRESH() function to refresh ionly the current record. I never used it so I can't asy what happens :o))
>>>
>>>
>>>Refresh() what? The BizObj?
>>
>>He said refresh() function and meant it literally. Here's from help:
>>
>>REFRESH( ) FunctionSee Also
>>CREATE SQL VIEW | CURSORGETPROP( ) | CURSORSETPROP( )
>>Refreshes data in an updatable SQL view.
>>
>>REFRESH([nRecords [, nRecordOffset]] [, cTableAlias | nWorkArea])
>>Return Values
>>Numeric
>>
>>...
>>REFRESH( ) returns the number of records refreshed.

>
>Did not work as expected. I´ll send you ScreenShots. Ok?

The primary key is the connection between your record in the view, and the source record in the remote table. The record in the view has a zero for the key, and the saved record in the remote table has got a new key that the view doesn't know of, so it doesn't refresh. There's no record with a key of zero in the remote table, and no record with the new key value in the view. So refresh doesn't find it.

What you can do, is to fetch only the last key - through a little SPT script (assuming you're still sitting on the new record in your remote view):
sqlexec(h, "SELECT @@IDENTITY AS lastkey","crsLastKey")
replace nKey with crslastkey.lastkey in rv_myview
use in crsLastKey
refresh(1, "rv_myview")
You'd need to know the handle (first parameter in the sqlexec() call) to do this, but I figure it can be obtained from the RV via a cursorgetprop("connecthandle").

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform