Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best method for SQL updates
Message
De
07/09/2003 07:48:06
 
 
À
06/09/2003 11:38:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00826743
Message ID:
00826848
Vues:
17
Cetin,

Thanks for the reply and the code sample. I have a few questions if you don't mind. Do you find that you prefer the method of creating the updatable cursor to doing an insert from values? Also, since you created the cursor with no filter, will it pull "all" the records from the server? Would it be better to add something like "where 1=0 " to the string so that the cursor would be empty? For this project, I am stuck using VFP 7 because it is a commercial accounting application and I have to run within the system so I will have to wait on the cursoradapters.

Thanks,
Bill
>I don't believe it should be so hard either :) Search for SPT and you'll find tons of samples. For a quick sample check this one that updates pubs.dbo.authors (what it does is to make an SPT cursor an updatable cursor) :
>
>
>lnHandle=Sqlstringconnect('DRIVER=SQL Server;'+;
>  'SERVER=servername;DATABASE=pubs;Trusted_Connection=Yes')
>SQLExec(lnHandle,'select * from dbo.authors','v_authors')
>CursorSetProp('KeyFieldList','au_id','v_authors')
>CursorSetProp('WhereType',1,'v_authors')
>CursorSetProp('Tables','authors','v_authors')
>
>CursorSetProp("UpdateNameList", ;
>  "au_id    authors.au_id,"+;
>  "au_lname authors.au_lname,"+;
>  "au_fname authors.au_fname,"+;
>  "contract authors.contract",'V_authors')
>
>CursorSetProp('UpdatableFieldList','au_fname,au_lname,contract','v_authors')
>CursorSetProp('SendUpdates',.T.,'v_authors')
>CursorSetProp('Buffering',5,'v_authors')
>Browse title "You're allowed to update lname, fname, contract"
>Tableupdate(2,.T.,'v_authors')
>SQLExec(lnHandle,'select * from dbo.authors','afterupdate')
>SQLDisconnect(lnHandle)
>Select afterupdate
>Browse
>
>
>PS: VFP8 cursoradapter makes this much easier.
>Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform