Hi,

I created a dataset by dragging a (SQL Server) stored
procedure from the Servers pane. The dataset consists of
three tables that are not linked (at least I do not
enforce contraints).

But when I try to populate the dataset by

SqlClient.SqlDataAdapter.Fill(ds, tableName)

I receive the following error:
"Failed to enable constraints. One or more rows contain
values violating non-null, unique, or foreign-key
constraints."

Please note that the same code works fine for a different
dataset, so there are no syntax errors.
I have checked that all the fields that are not marked as
minOccurs="0" return not Null values; I even tried to set
minOccurs="0" for all fields in the dataset - same result.

Please help....

Re: Dataset not populating by Sahil

Sahil
Mon Sep 27 21:13:50 CDT 2004

Simple .. the data you are filling into your dataset contains some data that
does not satisfy the constraints set on your dataset.

What constraint? That depends, but you can atleast view the data by setting
EnforceConstraints = false and then looking through the data to find out
which constraint is not being satisfied.

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik



"Sergey Poberezovskiy" <anonymous@discussions.microsoft.com> wrote in
message news:339401c4a4fd$a5a1ebf0$a301280a@phx.gbl...
> Hi,
>
> I created a dataset by dragging a (SQL Server) stored
> procedure from the Servers pane. The dataset consists of
> three tables that are not linked (at least I do not
> enforce contraints).
>
> But when I try to populate the dataset by
>
> SqlClient.SqlDataAdapter.Fill(ds, tableName)
>
> I receive the following error:
> "Failed to enable constraints. One or more rows contain
> values violating non-null, unique, or foreign-key
> constraints."
>
> Please note that the same code works fine for a different
> dataset, so there are no syntax errors.
> I have checked that all the fields that are not marked as
> minOccurs="0" return not Null values; I even tried to set
> minOccurs="0" for all fields in the dataset - same result.
>
> Please help....
>



Thank you by Sergey

Sergey
Mon Sep 27 21:44:32 CDT 2004

Sahil,

My problem was that the dataset variable I was trying to
fill was initialized to a different dataset (I just copied
the code and forgot to change it). But using Enforce
Contraints = False I was able to look at the data.

Thanks.

>-----Original Message-----
>Simple .. the data you are filling into your dataset
contains some data that
>does not satisfy the constraints set on your dataset.
>
>What constraint? That depends, but you can atleast view
the data by setting
>EnforceConstraints = false and then looking through the
data to find out
>which constraint is not being satisfied.
>
>- Sahil Malik
>You can reach me thru my blog -
>http://www.dotnetjunkies.com/weblog/sahilmalik
>
>
>
>"Sergey Poberezovskiy"
<anonymous@discussions.microsoft.com> wrote in
>message news:339401c4a4fd$a5a1ebf0$a301280a@phx.gbl...
>> Hi,
>>
>> I created a dataset by dragging a (SQL Server) stored
>> procedure from the Servers pane. The dataset consists of
>> three tables that are not linked (at least I do not
>> enforce contraints).
>>
>> But when I try to populate the dataset by
>>
>> SqlClient.SqlDataAdapter.Fill(ds, tableName)
>>
>> I receive the following error:
>> "Failed to enable constraints. One or more rows contain
>> values violating non-null, unique, or foreign-key
>> constraints."
>>
>> Please note that the same code works fine for a
different
>> dataset, so there are no syntax errors.
>> I have checked that all the fields that are not marked
as
>> minOccurs="0" return not Null values; I even tried to
set
>> minOccurs="0" for all fields in the dataset - same
result.
>>
>> Please help....
>>
>
>
>.
>

Re: Thank you by Sahil

Sahil
Mon Sep 27 22:09:43 CDT 2004

UR WELCOME !! :o)

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik


"Sergey Poberezovskiy" <anonymous@discussions.microsoft.com> wrote in
message news:401c01c4a505$157ed670$a401280a@phx.gbl...
> Sahil,
>
> My problem was that the dataset variable I was trying to
> fill was initialized to a different dataset (I just copied
> the code and forgot to change it). But using Enforce
> Contraints = False I was able to look at the data.
>
> Thanks.
>
>>-----Original Message-----
>>Simple .. the data you are filling into your dataset
> contains some data that
>>does not satisfy the constraints set on your dataset.
>>
>>What constraint? That depends, but you can atleast view
> the data by setting
>>EnforceConstraints = false and then looking through the
> data to find out
>>which constraint is not being satisfied.
>>
>>- Sahil Malik
>>You can reach me thru my blog -
>>http://www.dotnetjunkies.com/weblog/sahilmalik
>>
>>
>>
>>"Sergey Poberezovskiy"
> <anonymous@discussions.microsoft.com> wrote in
>>message news:339401c4a4fd$a5a1ebf0$a301280a@phx.gbl...
>>> Hi,
>>>
>>> I created a dataset by dragging a (SQL Server) stored
>>> procedure from the Servers pane. The dataset consists of
>>> three tables that are not linked (at least I do not
>>> enforce contraints).
>>>
>>> But when I try to populate the dataset by
>>>
>>> SqlClient.SqlDataAdapter.Fill(ds, tableName)
>>>
>>> I receive the following error:
>>> "Failed to enable constraints. One or more rows contain
>>> values violating non-null, unique, or foreign-key
>>> constraints."
>>>
>>> Please note that the same code works fine for a
> different
>>> dataset, so there are no syntax errors.
>>> I have checked that all the fields that are not marked
> as
>>> minOccurs="0" return not Null values; I even tried to
> set
>>> minOccurs="0" for all fields in the dataset - same
> result.
>>>
>>> Please help....
>>>
>>
>>
>>.
>>