J'ai cette procédure stockée qui lorsqu'elle est éxécutée dans mon projet c# .Net me retourne l'erreur "Un curseur nommé curs existe déjà", cette erreur est je crois la 16915.

Pourtant il y a bien close curs et deallocate curs.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 
 
 
 
/*CREATE PROCEDURE transfertdessocietes @num_temp as int,@utilisateur varchar(3) ,@societe_cible as varchar(11)  AS*/
CREATE PROCEDURE transfertdessocietes @num_temp as varchar(11),@utilisateur varchar(3) ,@societe_cible as varchar(11)  AS
/*sélection des intervenants à transférer*/
 
DECLARE @code_intervenant as int, @nom_intervenant as varchar(50),@prenom_intervenant as varchar(30),@libelle_sexe as varchar(30),@etiquette as varchar(8000)
DECLARE @Departement_societe as varchar(200),@intitule_societe as varchar(120), @adresse as varchar(250), @cp as varchar(6),@ville as varchar(65),@pays as varchar(25)
DECLARE @Voeux as int,@compte_societe as varchar(11), @societe_source as varchar(11)
begin  transaction
SELECT @societe_source = @num_temp
 
declare curs scroll cursor
	for
	/*SELECT  INTERVENANT.Code_intervenant, INTERVENANT.Nom_intervenant, INTERVENANT.Prenom_intervenant, INTERVENANT_SOCIETE.Type_voeux_intervenant, SEXE.Libelle_sexe
	FROM temp_compte INNER JOIN (SEXE RIGHT JOIN (INTERVENANT_SOCIETE INNER JOIN INTERVENANT ON INTERVENANT_SOCIETE.Code_intervenant = INTERVENANT.Code_intervenant) 
	ON SEXE.Code_sexe = INTERVENANT.Sexe_intervenant) ON temp_compte.compte_societe = INTERVENANT_SOCIETE.Compte_societe
	WHERE (((INTERVENANT_SOCIETE.Inactif_intervenant_societe)=0) AND ((temp_compte.num_temp_fusion)=@num_temp))*/
	SELECT INTERVENANT.Code_intervenant, INTERVENANT.Nom_intervenant, INTERVENANT.Prenom_intervenant, INTERVENANT_SOCIETE.Type_voeux_intervenant, SEXE.Libelle_sexe
	FROM SOCIETE INNER JOIN (SEXE RIGHT JOIN (INTERVENANT_SOCIETE INNER JOIN INTERVENANT ON INTERVENANT_SOCIETE.Code_intervenant = INTERVENANT.Code_intervenant) 
	ON SEXE.Code_sexe = INTERVENANT.Sexe_intervenant) ON SOCIETE.compte_societe = INTERVENANT_SOCIETE.Compte_societe
	WHERE ((INTERVENANT_SOCIETE.Inactif_intervenant_societe)=0) AND (SOCIETE.Compte_societe = @societe_source)
	open curs
	fetch first from curs into @code_intervenant,@nom_intervenant,@prenom_intervenant,@voeux,@libelle_sexe
 
	while (@@fetch_status <> -1) 
	begin
 
 
                     /* Tous les intervenants actifs de la société à transférer
                deviennent intervenants actifs de la société cible - par défaut code voeux */
                /* construction de l'étiquette*/
 
               /* select @etiquette = ""
  	  select  @etiquette=dbo.const_Etiquette_int_societe(@code_intervenant,@societe_cible)*/
 
           /* test si pas déjà existant dns la société cible*/
		UPDATE SOCIETE SET Intitule_societe = 'pppppppppppppppppppppp' where compte_societe = '000200'
		if not exists (select code_intervenant from  INTERVENANT_SOCIETE  where  Code_intervenant = @code_intervenant and  Compte_societe=@societe_cible)
			begin
                    		    /* transfert les intervenants*/
               			INSERT INTO INTERVENANT_SOCIETE ( Code_intervenant, Compte_societe, Date_maj_intervenant_societe, Type_voeux_intervenant, Inactif_intervenant_societe, Etiquette_intervenant_societe,Flag_intitule_societe,Flag_departement_societe,Flag_service_intervenant_societe,tampon)
                         			 SELECT @code_intervenant ,@societe_cible,getDate(),@voeux,0, @etiquette,1,1,1,0
					  if @@error!=0
                					begin
							close curs
 
							deallocate curs
                    						goto err
                    	 				end		
         			end
 
           fetch next from curs into @code_intervenant,@nom_intervenant,@prenom_intervenant,@voeux,@libelle_sexe
 
 
     end
 
close curs
 
deallocate curs
 
       /* historique des modifications*/
 
/*
     UPDATE  INTERVENANT_SOCIETE
         SET INTERVENANT_SOCIETE.Inactif_intervenant_societe = 1,
         INTERVENANT_SOCIETE.Cause_inactif_intervenant_societe = 'Transfert dans société' + @societe_cible , INTERVENANT_SOCIETE.Utilisateur_intervenant_societe = @utilisateur, 
         INTERVENANT_SOCIETE.Date_maj_intervenant_societe =getdate()
         from INTERVENANT_SOCIETE,temp_compte
        WHERE  temp_compte.compte_societe = INTERVENANT_SOCIETE.Compte_societe and INTERVENANT_SOCIETE.Inactif_intervenant_societe=0  and (temp_compte.num_temp_fusion)=@num_temp
  	if @@error!=0
                		begin
                    			goto err
                    	 	end		
         */
 
 
         /*mise en inactif des sociétés*/
      UPDATE SOCIETE  SET SOCIETE.Inactive_societe = 1,SOCIETE.Cause_cessation_societe = 'Transfert dans société ' + @societe_cible , SOCIETE.Utilisateur_societe = @utilisateur, SOCIETE.Date_maj_societe =getdate() ,
      Filiale_societe=@societe_cible ,date_filiale_societe=getdate()
     FROM societe
     WHERE SOCIETE.Compte_societe = @societe_source
     if @@error!=0
                		begin
                    			goto err
                    	 	end		
 
commit  transaction
return
 
err:
	rollback transaction
	return
GO
Si quelqu'un a la solution, ça m'aiderait beaucoup.
Merci!!!!