C
Crazy Cat
I've created a dataset that includes a tableadapter and table for
countries. Here is the table schema
CREATE TABLE [CAT].[Countries](
[CountryID] [smallint] IDENTITY(1,1) NOT NULL,
[RegionID] [smallint] NOT NULL,
[CountryCode] [varchar](12) NULL,
[CountryName] [nvarchar](100) NOT NULL,
[Recognized] [bit] NOT NULL CONSTRAINT [DF_Country_Recognized]
DEFAULT ((1))
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [CAT].[Countries] WITH CHECK ADD CONSTRAINT
[FK_Countries_to_Regions_by_RegionID] FOREIGN KEY([RegionID])
REFERENCES [CAT].[Regions] ([RegionID])
GO
ALTER TABLE [CAT].[Countries] CHECK CONSTRAINT
[FK_Countries_to_Regions_by_RegionID]
The contents of the table is 251 rows.
The contents of the table are retrieved via a stored procedure --
USE [FCAST]
GO
/****** Object: StoredProcedure [CAT].[usp_select_countries]
Script Date: 01/28/2008 17:22:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE [CAT].[usp_select_countries]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT [CountryID]
,[RegionID]
,[CountryCode]
,[CountryName]
,[Recognized]
FROM CAT.[Countries]
ORDER BY CountryName ASC
END
When I attempt to set the datasource of a combo box in the following
manner
combobox.datasource = adapter.getdata where adapter is a tableadapter
for the country table
I get the following error {"Failed to enable constraints. One or more
rows contain values violating non-null, unique, or foreign-key
constraints."}
I've checked the table -- no primary key violations or null exceptions
that I can see -- I even change the stored procedure so that it just
returns the first five rows just to prove to myself I'm not crazy and
I still get this same error! What's funny is that this code worked
for the last few months -- this morning I had to rebuild part of the
dataset (because of surprise, surprise, another stupid MicroCrap
error) and suddenly this I get this error on this one table.
Can anyone help ? I am beyond frustrated.
Thanks,
countries. Here is the table schema
CREATE TABLE [CAT].[Countries](
[CountryID] [smallint] IDENTITY(1,1) NOT NULL,
[RegionID] [smallint] NOT NULL,
[CountryCode] [varchar](12) NULL,
[CountryName] [nvarchar](100) NOT NULL,
[Recognized] [bit] NOT NULL CONSTRAINT [DF_Country_Recognized]
DEFAULT ((1))
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [CAT].[Countries] WITH CHECK ADD CONSTRAINT
[FK_Countries_to_Regions_by_RegionID] FOREIGN KEY([RegionID])
REFERENCES [CAT].[Regions] ([RegionID])
GO
ALTER TABLE [CAT].[Countries] CHECK CONSTRAINT
[FK_Countries_to_Regions_by_RegionID]
The contents of the table is 251 rows.
The contents of the table are retrieved via a stored procedure --
USE [FCAST]
GO
/****** Object: StoredProcedure [CAT].[usp_select_countries]
Script Date: 01/28/2008 17:22:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Create date:
-- Description:
-- =============================================
CREATE PROCEDURE [CAT].[usp_select_countries]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT [CountryID]
,[RegionID]
,[CountryCode]
,[CountryName]
,[Recognized]
FROM CAT.[Countries]
ORDER BY CountryName ASC
END
When I attempt to set the datasource of a combo box in the following
manner
combobox.datasource = adapter.getdata where adapter is a tableadapter
for the country table
I get the following error {"Failed to enable constraints. One or more
rows contain values violating non-null, unique, or foreign-key
constraints."}
I've checked the table -- no primary key violations or null exceptions
that I can see -- I even change the stored procedure so that it just
returns the first five rows just to prove to myself I'm not crazy and
I still get this same error! What's funny is that this code worked
for the last few months -- this morning I had to rebuild part of the
dataset (because of surprise, surprise, another stupid MicroCrap
error) and suddenly this I get this error on this one table.
Can anyone help ? I am beyond frustrated.
Thanks,