PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

dataset constraint exception

 
 
Tom
Guest
Posts: n/a
 
      23rd Jul 2003
Well, another day, another problem it seems. I would REALLY appreciate some
help here. I've looked all over already and come up empty handed. so here
we go:

I have a database program that accesses an Access 2000 DB (unfortunately).
Im using 2 views that are derived from 3 tables (tblGroup, tblEmployee,
tblEmployeeGroup)

tblGroup(*groupID, groupName, etc)
groupid->autonumber
groupName->string
tblEmployee(*employeeID,name, etc)
employeeID->autonumber
name->string
tblEmployeeGroup(*employeeID,*groupID)
employeeID->foreign key
groupID->foreign key

i have 2 comboxes on a windows form (cmbGroup and cmbEmployee).
-cmbGroup displays all the groups
-cmbGroup is filled with a view of all the groups and the
selectedvalue is bound to groupID
-cmbEmployee displays only the employees in the group that cmbGroup is
displaying
-cmbEmployee is filled with stored procedure(view) that gets a
parameter(groupID) that i set to cmbGroup.selectedvalue

All my tables/views are stored in the same dataset.

so, everytime cmbGroup's selectedvalue is changed, the cmbGroup
selectedvalueChanged is called and i clear the tblEmployee table in the
dataset, then refill with the proper parameter. all is well.
But, as soon as I select an employee in cmbEmployee, then select a different
group from cmbGroup, cmbGroup becomes "sticky". As soon as you select a
different group, then click on the actual windows form (to give it focus),
it goes back to the previous group selected. So, cmbGroup.selectedvalue
doesn't change to the newly selected value! therefore, cmbEmployee will
also not update to the relevant employees in the group that was actually
selected. Then the program crashes with this error:

"An unhandled exception of type 'System.Data.ConstraintException' occurred
in system.data.dll
Additional information: Column 'groupID' is constrained to be unique. Value
'4' is already present."

Now, i understand the error, but how to fix it? Is it a dataset property i
have to set? I've looked at LOTS of other news groups through google/groups
and so far have come up with nothing like this. If someone could please
help me with this, that would be great. thx

tom


 
Reply With Quote
 
 
 
 
Tom
Guest
Posts: n/a
 
      25th Jul 2003
Well, i'm assuming no one knows anything about this. if someone could just
confirm that, then i'll give up with this news group. so yeah, any feed
back would be really appreciated.

"Tom" <(E-Mail Removed)> wrote in message
news:t4BTa.524091$(E-Mail Removed)...
> Well, another day, another problem it seems. I would REALLY appreciate

some
> help here. I've looked all over already and come up empty handed. so

here
> we go:
>
> I have a database program that accesses an Access 2000 DB (unfortunately).
> Im using 2 views that are derived from 3 tables (tblGroup, tblEmployee,
> tblEmployeeGroup)
>
> tblGroup(*groupID, groupName, etc)
> groupid->autonumber
> groupName->string
> tblEmployee(*employeeID,name, etc)
> employeeID->autonumber
> name->string
> tblEmployeeGroup(*employeeID,*groupID)
> employeeID->foreign key
> groupID->foreign key
>
> i have 2 comboxes on a windows form (cmbGroup and cmbEmployee).
> -cmbGroup displays all the groups
> -cmbGroup is filled with a view of all the groups and the
> selectedvalue is bound to groupID
> -cmbEmployee displays only the employees in the group that cmbGroup is
> displaying
> -cmbEmployee is filled with stored procedure(view) that gets a
> parameter(groupID) that i set to cmbGroup.selectedvalue
>
> All my tables/views are stored in the same dataset.
>
> so, everytime cmbGroup's selectedvalue is changed, the cmbGroup
> selectedvalueChanged is called and i clear the tblEmployee table in the
> dataset, then refill with the proper parameter. all is well.
> But, as soon as I select an employee in cmbEmployee, then select a

different
> group from cmbGroup, cmbGroup becomes "sticky". As soon as you select a
> different group, then click on the actual windows form (to give it focus),
> it goes back to the previous group selected. So, cmbGroup.selectedvalue
> doesn't change to the newly selected value! therefore, cmbEmployee will
> also not update to the relevant employees in the group that was actually
> selected. Then the program crashes with this error:
>
> "An unhandled exception of type 'System.Data.ConstraintException' occurred
> in system.data.dll
> Additional information: Column 'groupID' is constrained to be unique.

Value
> '4' is already present."
>
> Now, i understand the error, but how to fix it? Is it a dataset property

i
> have to set? I've looked at LOTS of other news groups through

google/groups
> and so far have come up with nothing like this. If someone could please
> help me with this, that would be great. thx
>
> tom
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which CHECK constraint causes the exception? ferg Microsoft C# .NET 3 21st May 2006 09:38 PM
Catching a Constraint Exception =?Utf-8?B?Y2xpY2tvbg==?= Microsoft ASP .NET 5 29th Mar 2006 01:47 PM
Design to mitigate Exception constraint Marty McDonald Microsoft Dot NET 0 29th Sep 2004 09:30 PM
Catching a DataSet constraint exception that is used in data bindi =?Utf-8?B?bSBhbGxlbg==?= Microsoft Dot NET Framework Forms 0 24th Jul 2004 01:16 PM
Find out which row/constraint triggers the constraint exception =?Utf-8?B?UmFtb24gZGUgS2xlaW4=?= Microsoft ADO .NET 1 2nd Jul 2004 10:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:57 AM.