Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Offline views and SQL Server transactions
Message
De
09/08/2004 19:00:05
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
 
À
05/08/2004 16:51:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00931148
Message ID:
00931906
Vues:
20
Take a look a the help in the SQLSETPROP section and look at the Transactions property. You probably need to set it to 2. Also look at the help on SQLCOMMIT & SQLROLLBACK
>
>My application will usually be used with four offline views of data that is stored in SQL Server. Once a user is done, the files will be returned to us and the views will be brought back online, automatically uploading the data to SQL Server. This works fine.
>
>But what if it doesn't work fine? What if three of the views upload successfully and the fourth bombs? I tried wrapping the uploads in SQLExec() calls to create a transaction and then roll it back, and data gets uploaded anyway.
>
>The views are all created from the same connection and are sharing it. I use DBSETPROP() to get the name of the connection a view is using and then to get the connection string for that connection. Then, I call SQLSTRINGCONNECT() with the second argument set to .T. to use the same connection the views should be using. Then I issue SQLExec(lnSqlHandle, 'BEGIN TRANSACTION'). Then I bring the views online by issuing USE ViewName ONLINE EXCLUSIVE followed by TABLEUPDATE(). Then I issue SQLExec(lnSqlHandle, 'IF @@TRANCOUNT > 0 ROLLBACK'). Once all this completes, I look at my SQL Server table and I see that the data that should have been rolled back was there.
>
>Is what I am trying to do possible? If so, what am I doing wrong?
>
>Thanks very much!
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform