USE [inventory]
GO
/****** Object: Table [dbo].[Featurelist3] Script Date: 05/28/2016 12:58:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Featurelist3](
[Featurelist_Id] [int] IDENTITY(1,1) NOT NULL,
[Featurelist_Name] [nvarchar](50) NULL,
[Featurelist_order] [nvarchar](50) NULL,
[Subcategory_Id] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Featurelist_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Featurelist3] WITH CHECK ADD FOREIGN KEY([Subcategory_Id])
REFERENCES [dbo].[Subcategories] ([Subcategory_Id])
GO
USE [inventory]
GO
/****** Object: Table [dbo].[Subcategories] Script Date: 05/28/2016 12:59:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Subcategories](
[Subcategory_Id] [int] IDENTITY(1,1) NOT NULL,
[Subcategory_Code] [varchar](20) NULL,
[Subcategory_Name] [varchar](20) NULL,
[Subcategory_Desc] [varchar](50) NULL,
[Category_Id] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Subcategory_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Insert Error:The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The statement has been terminated.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Insert Error:The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The statement has been terminated.
The statement has been terminated.
Source Error:
Line 391: string msg = "Insert Error:";
Line 392: msg += ex.Message;
Line 393: throw new Exception(msg);
Line 394:
Line 395: }
Source File: d:\C#Practice\StoreInventory\StoreInventory\Subcategories.aspx.cs Line: 393
Stack Trace:
[Exception: Insert Error:The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Featureli__Subca__6319B466". The conflict occurred in database "inventory", table "dbo.Subcategories", column 'Subcategory_Id'.
The statement has been terminated.
The statement has been terminated.]
StoreInventory.Subcategory.InsertRecords(StringCollection sc) in d:\C#Practice\StoreInventory\StoreInventory\Subcategories.aspx.cs:393
StoreInventory.Subcategory.Button1_Click(Object sender, EventArgs e) in d:\C#Practice\StoreInventory\StoreInventory\Subcategories.aspx.cs:321
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9750842
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724