TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
albert albert
NA
524
0
Cannot insert value in database
Oct 4 2011 9:12 AM
Hi everyone,
I have 3 tables:
[code]
CREATE TABLE [flowsuitedata].[Complaint](
[ComplaintId] [int] NOT NULL,
[OrderNumber] [int] NULL,
[InvoiceNumber] [int] NULL,
[DescriptionComplaint] [ntext] NULL,
[CustomerContactPerson] [ntext] NULL,
[OwnContactPerson] [ntext] NULL,
[ResolutionDescription] [nvarchar](50) NULL,
[RelatedSuborder] [nvarchar](50) NULL,
[Responsible] [nvarchar](50) NULL,
[StatusComplaint] [varchar](50) NULL,
[Amount] [int] NULL,
[StartDateComplaint] [datetime] NULL,
[EndDateComplaint] [datetime] NULL,
[ComplaintAssignedOwnContactPerson] [ntext] NULL,
[ResponsibleId] [int] IDENTITY(1,1) NOT NULL,
[StatusId] [int] NOT NULL,
CONSTRAINT [PK_Complaint] PRIMARY KEY CLUSTERED
[/code]
[code]
[code]
CREATE TABLE [flowsuitedata].[Status](
[StatusId] [int] IDENTITY(1,1) NOT NULL,
[Kind_status] [varchar](50) NULL,
CONSTRAINT [PK_Status] PRIMARY KEY CLUSTERED
(
[StatusId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
[/code]
CREATE TABLE [flowsuitedata].[Responsible](
[ResponsibleId] [int] IDENTITY(1,1) NOT NULL,
[Kind_Responsible] [varchar](50) NULL,
CONSTRAINT [PK_Responsible] PRIMARY KEY CLUSTERED
(
[ResponsibleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
[/code]
But I still get the error:
"Cannot insert the value NULL into column 'StatusId', table 'XeroxTest.flowsuitedata.Complaint'; column does not allow nulls. INSERT fails."
by this query:
[INSERT INTO Complaint(InvoiceNumber, DescriptionComplaint,CustomerContactPerson,OwnContactPerson,ResolutionDescription,RelatedSuborder,Responsible,StatusComplaint,Amount,StartDateComplaint,EndDateComplaint, ComplaintAssignedOwnContactPerson)
VALUES(77, 'hoi', 'hoi', 'hoi', 'hoi', 'hoi', 'hoi','hoi',99,'10/4/2011','10/4/2011', 'hallo');]
And I have put in every table set the property: Is Identity to Yes.
THX for helping!!
Reply
Answers (
21
)
Field Validators and Post backs
How to import a csv file and save it to sql server