Thursday, September 30, 2010
Thursday, September 23, 2010
Uninstall errors
I am testing an application and was unable to uninstall. I was getting these errors:
Kind of a long and boring story, but writing it down for future reference. I test the msi's on a Virtual Machine with SQL Server and IIS installed and undo disks enabled, so I can roll back after installing software.
The other day I made copies of this Virtual PC and installed 3 different versions of the software. Later on I found out I could not start more than one of the Virtual PCs at the same time because they all used the same machine name and MAC address.
So then I renamed the computer, reassigned the MAC address, and renamed the SQL server in 3 of the Virtual PCs. Now I have 4 Virtual PC's: one with the OS, SQL Server, and IIS and 3 more with different versions of the application.
The application would not uninstall on one of the renamed machines, so first I thought it was storing the PC name someplace in the registry. But then I remembered I tried running Repair from Add/Remove Programs before I tried uninstalling. So I tried to reproduce the error on the Virtual PC that was not renamed. It was Repair that caused Error 1001 on uninstall.
So it's best to remember exactly what you did, then verify the error can be reproduced. I really thought that bug had something to do with changing the machine name.
- Error 1001. The savedState dictionary contains inconsistent data and might have been corrupted.
- Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. --> The specified service does not exist as an installed service
Kind of a long and boring story, but writing it down for future reference. I test the msi's on a Virtual Machine with SQL Server and IIS installed and undo disks enabled, so I can roll back after installing software.
The other day I made copies of this Virtual PC and installed 3 different versions of the software. Later on I found out I could not start more than one of the Virtual PCs at the same time because they all used the same machine name and MAC address.
So then I renamed the computer, reassigned the MAC address, and renamed the SQL server in 3 of the Virtual PCs. Now I have 4 Virtual PC's: one with the OS, SQL Server, and IIS and 3 more with different versions of the application.
The application would not uninstall on one of the renamed machines, so first I thought it was storing the PC name someplace in the registry. But then I remembered I tried running Repair from Add/Remove Programs before I tried uninstalling. So I tried to reproduce the error on the Virtual PC that was not renamed. It was Repair that caused Error 1001 on uninstall.
So it's best to remember exactly what you did, then verify the error can be reproduced. I really thought that bug had something to do with changing the machine name.
Thursday, September 2, 2010
foreign key constraint violation
A foreign key constraint violation can happen if you delete a row that is referenced in another table. When the constraint is violated the error message in SQL Server is "INSERT statement conflicted with COLUMN FOREIGN KEY constraint".
table named Person with an identity column PersonID
table named PersonPhones references Person.PersonID
the constraint is on the Person table
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_PersonID] FOREIGN KEY([PersonID])
REFERENCES [dbo].[PersonPhones] ([PersonID])
The row cannot be deleted from Person if the PersonID exists in PersonPhones. The concept is the same in any RDBMS. The constraint could also be set up to automatically update and delete rows from the child table. It would look like this:
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_PersonID] FOREIGN KEY([PersonID])
REFERENCES [dbo].[PersonPhones] ([PersonID])
ON UPDATE CASCADE
ON DELETE CASCADE
It's just something the program should check. If you add a new person all fields should contain a value before you can say CRUD was successful. (CRUD=Create, Read, Update, Delete) If nothing else the user should be given a more friendly error message.
table named Person with an identity column PersonID
table named PersonPhones references Person.PersonID
the constraint is on the Person table
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_PersonID] FOREIGN KEY([PersonID])
REFERENCES [dbo].[PersonPhones] ([PersonID])
The row cannot be deleted from Person if the PersonID exists in PersonPhones. The concept is the same in any RDBMS. The constraint could also be set up to automatically update and delete rows from the child table. It would look like this:
ALTER TABLE [dbo].[Person] WITH CHECK ADD CONSTRAINT [FK_PersonID] FOREIGN KEY([PersonID])
REFERENCES [dbo].[PersonPhones] ([PersonID])
ON UPDATE CASCADE
ON DELETE CASCADE
It's just something the program should check. If you add a new person all fields should contain a value before you can say CRUD was successful. (CRUD=Create, Read, Update, Delete) If nothing else the user should be given a more friendly error message.
Subscribe to:
Posts (Atom)