Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server RAISERROR function
Message
De
22/09/2004 12:19:50
 
 
À
22/09/2004 12:01:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00945047
Message ID:
00945070
Vues:
15

I have the following query that I submit from VFP80 to MSSQL-2000.

UPDATE Employees
SET ReportsTo = 5
WHERE ReportsTo = 2

IF @@ROWCOUNT = 0
BEGIN
RAISERROR('No rows were updated',16,1)
END


As you can see I want to trap the condition of no rows updated with the IF @@ROWCOUNT = 0 clause. My problem is that when I submit this query from Visual FoxPro using the SQLEXEC() command and if no rows were updated by the SQL command I get an ODBC error using the AERROR(ODBCError) function. The values in the ODBCError array:

1526

Connectivity error: Unable to retrieve specific
ERROR information. Driver is probably out of resources

.NULL.
.NULL.
.NULL.
.NULL.
.NULL.
.NULL.

This doesn't seem right and I don't know if I should rely on this to determine that I had a problem or not. Am I doing something wrong or is there another way to do it?

Jim White


This is a VFP bug. It is fixed into VFP9beta.

Repro:
clear
h=SQLCONNECT()
IF h>0
	IF SQLEXEC(H,	[SELECT 1 WHERE 1=0;
			IF @@ROWCOUNT=0;
				RAISERROR('none rows',16,1);
			])<0
		=AERROR(aODBC)
		DISPLAY MEMORY LIKE aODBC
	ENDIF
	=SQLDISCONNECT(h)
ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform