Question ConstraintException, Column 'Date' is constrained to be unique?

chopndroptx

New member
Joined
Jun 22, 2011
Messages
1
Programming Experience
Beginner
I am new to VB and trying to teach myself.

Using VS 2010 & SQL Server 2008 R2

I have a table setup with a Date column as the Primary Key that does not allow Null.

Right now I have 6 items/rows in the table to navigate with.

I am using the MonthCalendar as the bindingsource for the Date column.

I keep getting this error when i get to record 3 using the BindingNavigator. It will throw this error no matter which date I have selected on the monthcalendar and it will show the dates I have selected in the error, although I know some of the dates I have selected are not in the table itself.
"ConstraintException was unhandled"
"Column 'Date' is constrained to be unique. Value '6/8/2011, 6/8/2011' is already present."
ConstraintException.jpg

I dont know why I am getting the error from navigating or why it has double dates, it should only be one date.:confused:
I also get this error when trying to save.

Im using the BindingNav for most of my commands like this "Me.WitnessMainTableBindingNavigator.AddNewItem.PerformClick()"

To me it seems like the dataset is not clearing for some reason. And it seems to be trying to insert the selected date into the dataset without me adding it.

Any help would be appreciated! And I look forward to working with everyone! Take it easy on me, trying to explain the best I can. lol
Thanks Everyone!
 

Attachments

  • MyForm.jpg
    MyForm.jpg
    151.1 KB · Views: 29
Back
Top