Hi Everyone,
I am new to C#, kind of new to programming altogether. It is something I am really enjoy learning but I am a little stuck with hierarchical updates.
I am using Visual Studio 2008 and SQL Express.
I have been working on a simple application for my girlfriends business. I have a database with 2 tables, Customers & Vacancies. I use the IDE to create the data-bound controls, Customers being "Details" and Vacancies being "DataGridVi ew".
On the Customer table I have a CustomerID column. This is a Primary Key and has Identity configured so each record is unique and the number is incremented.
I created a Foreign Key Constraint (one to many) from Customer - CustomerID to Vacancies - CustomerID. I did this so each record in the Vacanacie table would update when the Customer is changed on the form.
I may have got some words wrong there, but hopefully you know what I am getting at =)
When I run the program, i receive the following error in debug mode when I try and add a user and vacancy at the same time.
"The UPDATE statement conflicted with the FOREIGN KEY constraint"
I found an article on MSDN (http://msdn.microsoft. com/en-us/library/bb384432.aspx) that sounds like just what I am trying to achieve.
I went through the walkthrough step by step, when I run the program in debug and try to add a customer and an order together, I receive the following error
"The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_Orders_Empl oyees". The conflict occurred in database "90C91394EA995F 36B4DCCD90A88CC CD8_008\PROJECT S\HIERARCHICALU PDATEWALKTHROUG H\HIERARCHICALU PDATEWALKTHROUG H\BIN\DEBUG\NOR THWND.MDF", table "dbo.Employees" , column 'EmployeeID'."
This is the same error as I receive in my application.
Has anyone else had problems with this walkthrough? If I can solve this, then I am confident I can solve the problem with my application.
I hope all this makes sense, this is a huge learning curve for me.
Many thanks
Dave
I am new to C#, kind of new to programming altogether. It is something I am really enjoy learning but I am a little stuck with hierarchical updates.
I am using Visual Studio 2008 and SQL Express.
I have been working on a simple application for my girlfriends business. I have a database with 2 tables, Customers & Vacancies. I use the IDE to create the data-bound controls, Customers being "Details" and Vacancies being "DataGridVi ew".
On the Customer table I have a CustomerID column. This is a Primary Key and has Identity configured so each record is unique and the number is incremented.
I created a Foreign Key Constraint (one to many) from Customer - CustomerID to Vacancies - CustomerID. I did this so each record in the Vacanacie table would update when the Customer is changed on the form.
I may have got some words wrong there, but hopefully you know what I am getting at =)
When I run the program, i receive the following error in debug mode when I try and add a user and vacancy at the same time.
"The UPDATE statement conflicted with the FOREIGN KEY constraint"
I found an article on MSDN (http://msdn.microsoft. com/en-us/library/bb384432.aspx) that sounds like just what I am trying to achieve.
I went through the walkthrough step by step, when I run the program in debug and try to add a customer and an order together, I receive the following error
"The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_Orders_Empl oyees". The conflict occurred in database "90C91394EA995F 36B4DCCD90A88CC CD8_008\PROJECT S\HIERARCHICALU PDATEWALKTHROUG H\HIERARCHICALU PDATEWALKTHROUG H\BIN\DEBUG\NOR THWND.MDF", table "dbo.Employees" , column 'EmployeeID'."
This is the same error as I receive in my application.
Has anyone else had problems with this walkthrough? If I can solve this, then I am confident I can solve the problem with my application.
I hope all this makes sense, this is a huge learning curve for me.
Many thanks
Dave
Comment