Problème procédure stockée + formview

hugo7 Messages postés 352 Date d'inscription samedi 11 décembre 2010 Statut Membre Dernière intervention 29 juin 2011 - 29 janv. 2009 à 12:47
hugo7 Messages postés 352 Date d'inscription samedi 11 décembre 2010 Statut Membre Dernière intervention 29 juin 2011 - 29 janv. 2009 à 17:22
Bonjour voila j'ai une table contenant ces champs :

sujet_id    int 
sujet_texte    nvarchar(MAX)  
categorie_id    int  
réponse_id    int   
réponse_texte    nvarchar(MAX)  
heure    datetime   
utilisateur_id    nvarchar(50)  

Ensuite dans une page j'ai un formview qui ajoute des données dans cette table avec une procédure stockée :

ALTER PROCEDURE dbo.StoredProcedure5
    @sujet_id int
    ,@réponse_texte Nvarchar(MAX)
    ,@heure datetime
    ,@utilisateur_id Nvarchar (50)
    As
    Insert Into [reponsesujetlibre]
    ([sujet_id],[réponse_texte],[heure],[utilisateur_id])
    values
    (@sujet_id,@réponse_texte,@heure,@utilisateur_id)
    RETURN @@IDENTITY

Le problème ces que lorsque j'ajoute les données il me met l'erreur suivante :

Cannot insert the value NULL into column 'réponse_id',
table 'db_debatoo2_1.dbo.reponsesujetlibre'; column does not allow
nulls. INSERT fails.
The statement has been terminated.
The
'StoredProcedure5' procedure attempted to return a status of NULL,
which is not allowed. A status of 0 will be returned instead.

3 réponses

hugo7 Messages postés 352 Date d'inscription samedi 11 décembre 2010 Statut Membre Dernière intervention 29 juin 2011
29 janv. 2009 à 12:48
Mince l'erreur ne c'est pas mise ,  la voilà:

Cannot insert the value NULL into column 'réponse_id',
table 'db_debatoo2_1.dbo.reponsesujetlibre'; column does not allow
nulls. INSERT fails.
The statement has been terminated.
The
'StoredProcedure5' procedure attempted to return a status of NULL,
which is not allowed. A status of 0 will be returned instead.
0
hugo7 Messages postés 352 Date d'inscription samedi 11 décembre 2010 Statut Membre Dernière intervention 29 juin 2011
29 janv. 2009 à 12:49
Pourquoi sa bug je vous la remet :

Cannot insert the value NULL into column 'réponse_id',
table 'db_debatoo2_1.dbo.reponsesujetlibre'; column does not allow
nulls. INSERT fails.
The statement has been terminated.
The
'StoredProcedure5' procedure attempted to return a status of NULL,
which is not allowed. A status of 0 will be returned instead.
0
hugo7 Messages postés 352 Date d'inscription samedi 11 décembre 2010 Statut Membre Dernière intervention 29 juin 2011
29 janv. 2009 à 17:22
Mince je me suis tromper d'erreur , voici la vrai erreur :
 
Violation of primary key constraint 'PK_reponsesujetlibre_1.Cannot insert duplicate key in object 'dbo.reponsesujetlibre'.
The statement has been terminated.
The 'StoredProcedure5' procedure attempted to return a status ok NULL , which is not allowed.
A statut of 0 will be returned instead
0
Rejoignez-nous