Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 8 - SQL 2000 db - need advice with inefficient updat
Message
De
03/09/2003 12:37:39
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00825623
Message ID:
00825738
Vues:
14
Hi Nancy.

>like most of us I am using VFP with a remote SQL database more and more. I am getting used to it but one thing which I find really inefficient is updating the SQL database. Below is an example of a VFP .prg that updates an email address field in the SQL table. As you can see I am currently updating one record at a time. This is the same way I was doing in earlier versions of VFP. Is there any way to make the update below more efficient in VFP 8.0?
>
>***select VFP table
>select emailtoprocess
>
>***update SQL table
>SCAN
> scatter memvar
> = sqlprepare(gnConnHandle, "UPDATE Emailunsubscribe SET bademail = 1 WHERE email = ?m.email")
> = sqlexec(gnConnHandle)
>endscan

If you use an updatable remote view, all you have to do is update the fields in the VFP cursor (which should be table buffered), then issue TABLEUPDATE() to write all the changes at once to SQL SERVER. Of course, behind the scenes, VFP is doing what you're doing -- sending individual UPDATE statements to SQL Server. However, it's a lot more efficient to let VFP do that.

Doug
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform