|
Violation of PRIMARY KEY constraint 'PK__Registra__1788CC4C180CE6D9'. Cannot insert duplicate key in object 'dbo.Registration'. The duplicate key value is (0).
The statement has been terminated.
This is an Mvc 4 razor
|
|
|
|
|
Actually it's a database issue.
|
|
|
|
|
Means there already is a record with id '0' in the database. If it is not an auto-incrementing field, you might need a way to get the last and increment it. If it is a new application, then it may be easier to change the type of the field to a GUID and put a freshly generated GUID in there.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This may sound crazy but I have many copies of a .net project's source code in source control but am trying to figure out which copy of the source code in the version control system is the correct code that was used to build the currently deployed production application's projects. The application was deployed several years ago and we have several versions of the source code but don't know which version in source control matches the actual production's code. I have read about reflector but was wondering if there was a more simple was to go. Can anyone help?
modified 24-May-16 12:39pm.
|
|
|
|
|
Can't unless you adhered to a rational software lifecycle pattern and it sounds like you (or they?) didn't. Look for a branch or a label or something that might give a clue. Which version control system?
|
|
|
|
|
They have Sourcesafe but we don't even know if the correct code is even there.
|
|
|
|
|
Decompiling and diff'ing against the source versions? The version with the least differences should be your best bet.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
When you say decompile do you mean by using a tool like Reflector?
|
|
|
|
|
Yep.
Seriously, this happened because of a lack of controls of the source code and management of the change system.
Now you're paying the price for it.
|
|
|
|
|
One final thought I had was to download the production project dll's and one at a time for each dll load the project's code from source control into Visual Studio as a individual projects. Next, make sure all of the production dlls, exception for the one who's source code is being build are referenced, compile in release mode, then compaire file sizes. Does this this make since?
|
|
|
|
|
It MIGHT work, but you have several possible problems.
First, you have no idea if the code in source control is CURRENTLY the code that produced the .DLL's. The code may have been modified since the release of the .DLL's.
You also don't know if the .DLL's are compiled as RELEASE or as DEBUG. Yes, I've seen both in production.
You also have a problem where it is possible to product the same size executable from two different sources. You have no idea if constants have been modified or something similar.
It's going to take a lot more comparison besides just looking at file sizes. You're going to have to do a byte-by-byte compare of the resulting executables.
|
|
|
|
|
Dave, thanks for your advise. I can see what's in source control and production and go from there.
|
|
|
|
|
Even a byte-by-byte comparison may not work.
A some point in the past, Microsoft compilers started adding information to each executable file (timestamp?), so that compiling the same source twice in succession didn't create identical executable files.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton
|
|
|
|
|
Message Closed
modified 25-May-16 17:36pm.
|
|
|
|
|
That assumes the code hasn't been modified since the project was last deployed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
comment faire un projet paint avec animation en xaml et c#
|
|
|
|
|
|
Yeah, I had no idea what he was posting and, frankly, putting my name in a subject line was creepy as hell.
|
|
|
|
|
I deleted the other two posts before this went all Single White Female.
This space for rent
|
|
|
|
|
Can VB.Net allow to create drill down for datagridview in windows application ?
modified 25-May-16 2:32am.
|
|
|
|
|
|
Hi,
I'm wondering if any of you know what is the maximum number of .NET Framework CLR Runtimes that can be installed on a computer ?
I'm writing an application, that loads a specific Runtime, and, the first function I wrote enumerates through the installed Runtimes, using the ICLRMetaHost, IEnumUnknown, and ICLRRuntimeInfo interfaces. This function works correctly (I have two installed runtimes on my computer).
Thanks for any information.
|
|
|
|
|
As far as I'm aware:
- 1.0 and 1.1 were separate CLRs, but only came in 32-bit versions;
- 2.0 has both 32- and 64-bit versions;
- 3.0 and 3.5 used the same CLR as 2.0;
- 4.0 has both 32- and 64-bit versions;
- 4.5 and 4.6 are in-place upgrades to 4.0;
So depending on whether you count 32- and 64-bit CLRs separately, the answer is either 4 or 6 (at the moment).
Of course, if Microsoft ever decide to release a new version of the framework that isn't an in-place upgrade to 4.0, the answer will change.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Why would there be a maximum?
|
|
|
|
|
Richard Deeming and Dave Kreskowiak,
Hey, thanks for the information. Yeah, I should have mentioned either 32-bit or 64-bit versions (my app is a 32-bit version running on WOW64). More than anything, I'm just curious,...
|
|
|
|