Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
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
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