Salut,
J'ai cree une table pour mettre mes articles en categories.
La procedure pour l'insertion de categories:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Column Name CategoryID int - PK AddedDate AddedBy Title Importance Description ImageUrl
J'obtients l'erreur suivante lots de l'insertion d'une nouvelle categorie:
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 ALTER PROCEDURE dbo.RA_Articles_InsertCategory ( @AddedDate datetime, @AddedBy nvarchar(256), @Title nvarchar(256), @Importance int, @Description nvarchar(4000), @ImageUrl nvarchar(256), @CategoryID int OUTPUT ) AS SET NOCOUNT ON -- check whether a category with the same name already exists DECLARE @CurrID int SELECT @CurrID = CategoryID FROM RA_Categories WHERE LOWER(@Title) = LOWER(Title) IF @CurrID IS NOT NULL BEGIN SET @CategoryID = -1 RETURN END INSERT INTO RA_Categories (AddedDate, AddedBy, Title, Importance, Description, ImageUrl) VALUES (@AddedDate, @AddedBy, @Title, @Importance, @Description, @ImageUrl) SET @CategoryID = scope_identity()
Je vous prie de m'aider
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Cannot insert the value NULL into column 'CategoryID', table 'C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\SENIORPROJECT\APP_DATA\ASPNETDB.MDF.dbo.RA_Categories'; column does not allow nulls. INSERT fails. The statement has been terminated.![]()
Partager