Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Raising Error in SQL Server
Message
De
21/01/2004 14:09:35
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Problem Raising Error in SQL Server
Divers
Thread ID:
00869151
Message ID:
00869151
Vues:
86
I've put together a screen that updates a MS SQL table using ODBC SPT. The following SQL command returns a value of 1 regardless of whether or not any rows were actually updated:

--------------------------------------------
BEGIN TRAN
UPDATE FSFormulaAttrib
SET Attrib_Val = "JWTEST"
WHERE Formula_ID = 316206 AND
Attrib_Code = "JWMATCH"
IF @@ROWCOUNT > 0
COMMIT TRAN
ELSE
RAISERROR ('No rows were updated',11,1)
ROLLBACK TRAN
--------------------------------------------

There are no rows in the table matching the selection criteria. There is one row where the Formula_ID is equal to 316206 but the value of Attrib_Code is 'C_MATCH'. The transaction should have returned a -1, then I could have
used AERROR() to trap the error and taken the appropriate action.

What gives? Am I coding the SQL transaction correctly? What are my alternatives? Any help would be greatly appreciated.

Jim White
Time is a wonderful teacher. Unfortunately it kills all of its students.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform