I was using the Member section and adding custom data types with no issues.
For no apparent reason I am getting this error when I try to create a new data type in any (including default Member) Member Type.
Anyone can shed some light what might be the likely issue? Would be greatly appreciated!
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsPropertyType_cmsDataType_nodeId". The conflict occurred in database "STAGING", table "dbo.cmsDataType", column 'nodeId'.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsPropertyType_cmsDataType_nodeId". The conflict occurred in database "STAGING", table "dbo.cmsDataType", column 'nodeId'.
The statement has been terminated.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_cmsPropertyType_cmsDataType_nodeId". The conflict occurred in database "STAGING", table "dbo.cmsDataType", column 'nodeId'.
The statement has been terminated.]
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase) +506
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData) +401
System.Action`1.EndInvoke(IAsyncResult result) +0
System.Web.UI.
We've traced back a bit further an dit looks like one of the other datatypes is returning with a 0 instead of -92 for the Comments section
But thats deep inside the CMS and we've not quite figured out why, in the end we had to do it programmatically and added the property via a page.
Which is obviously not ideal
We ran SQl profiler against our Umbraco User hitting the database and watch ed to see what values were attempting to be added and noticed that
as yet, we have no solution or cause, because we have tried it with a copy of the database and that works okay, we have triend updating code etc and thats fine, it's obviously something with our environment
Can I check which table had the value reference 0 ?
No matter what I do, if i open a memberType and click Save, I get the error message as above. Its also not one particular memberType, any of 4 have this issue.
When I check the tables [cmsContentType] and [cmsPropertyType] for the ID of the MemberType, I dont see any particular likely column which is having reference 0.
Did you locate this reference in a specific table? Really wanna find out whats causing it.
You have to watch the profiler to see which value was wrong. for me/us it was off the top of my head the label datatype which has a ID = -92 was returning as 0 in the update table query and that was failing and therefore killing the process
the table was cmsContentType and no we haven't isolated why , we think it may be environment related.. but have't checked that yet..
Thats pretty interesting because I just digged through the Express Profiler trace and I see the Label for instance Failed Password Attempts datatype shows 0 too.
It cant be coincidence, right? I cant seem to find where (or why) its coming as 0
That's the one, that's failing for me/us (Failed Password Attempts ) also and you are right that seems awfully odd.
I've not had any more time to go back and dig through to see where that zero is being set either...whatever it is is its wrong and thats the cause but we have not identified the reason
If and when we get a chance to replicate the environment we shall see aht we can do and share that..
Ravi
we ended up doing a script which did this to add the property
note psuedo code rather than actual code and you'll need to modify the ID values
var mts = ApplicationContext.Current.Services.MemberTypeService;
var membertype= mts.Get(5954);
var dt = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionById(-92);
var pt = new PropertyType(dt) {Alias = "xxx", Name = "yyyy"};
membertype.AddPropertyType(pt, "abc"); //property and tab name
mts.Save(membertype);
this is an existing web site and we were trying to update an existing member type, this was something we had no problem doing on our development environment, but in our production environment we have encountered this issue
we are using 7.2.4 but have tried it with a copy of the lvie database and our local code.
we have tried looking at it against upgraded code
we do not plan on changing or needto change the member type again, so its a wrinkle rather than a show stopper for us at the moment
but it doesn't explain why when we run this we can update the membertype but within umbraco it throws a wobbly
Member DataType creation - SQL Error
I was using the Member section and adding custom data types with no issues.
For no apparent reason I am getting this error when I try to create a new data type in any (including default Member) Member Type.
Anyone can shed some light what might be the likely issue? Would be greatly appreciated!
Hi Keilo
We've traced back a bit further an dit looks like one of the other datatypes is returning with a 0 instead of -92 for the Comments section
But thats deep inside the CMS and we've not quite figured out why, in the end we had to do it programmatically and added the property via a page. Which is obviously not ideal
We ran SQl profiler against our Umbraco User hitting the database and watch ed to see what values were attempting to be added and noticed that
as yet, we have no solution or cause, because we have tried it with a copy of the database and that works okay, we have triend updating code etc and thats fine, it's obviously something with our environment
regards
Hi Ravi
Thanks for the prompty reply.
Can I check which table had the value reference 0 ?
No matter what I do, if i open a memberType and click Save, I get the error message as above. Its also not one particular memberType, any of 4 have this issue.
When I check the tables [cmsContentType] and [cmsPropertyType] for the ID of the MemberType, I dont see any particular likely column which is having reference 0.
Did you locate this reference in a specific table? Really wanna find out whats causing it.
Im running Express Profiler from https://expressprofiler.codeplex.com/ as its a SQLExpress 2008 R2 DB.
You have to watch the profiler to see which value was wrong. for me/us it was off the top of my head the label datatype which has a ID = -92 was returning as 0 in the update table query and that was failing and therefore killing the process
the table was cmsContentType and no we haven't isolated why , we think it may be environment related.. but have't checked that yet..
Hey Ravi
Thats pretty interesting because I just digged through the Express Profiler trace and I see the Label for instance Failed Password Attempts datatype shows 0 too.
It cant be coincidence, right? I cant seem to find where (or why) its coming as 0
That's the one, that's failing for me/us (Failed Password Attempts ) also and you are right that seems awfully odd.
I've not had any more time to go back and dig through to see where that zero is being set either...whatever it is is its wrong and thats the cause but we have not identified the reason
Guess we are onto something if Failed Password Attempts is the culprit.
I couldnt figure out why, it was working (i.e. being able to add membertype properties with no issues) and no idea what broke it.
If you have any finding please share here.
If and when we get a chance to replicate the environment we shall see aht we can do and share that..
Ravi
we ended up doing a script which did this to add the property
note psuedo code rather than actual code and you'll need to modify the ID values
Thanks for sharing this, will give it a go when i get onto the computer.
Can I check,after running this code manually, are you able to go to Member section and add/update existing or new properties - i.e. normalize?
I have 4 member types, including the default and I get this error in all of them, as they share/inherit the likely culprit Failes Password Attempts.
no this was just a hard and frankly dirty way to get our property onto the membertype..
So the mystery remains...
I have been tracing the recent activity and trying to make sense of what might cause such a thing. Cant figure out as it appeared from nowhere.
Do you use a code where the member is created or updated programmatically in your website? Also which build of Umbraco 7 are you using?
This is the exact SQL query throwing the error caught from the profiler;
@0 parameter gets the value 0 for some weird reason.
this is an existing web site and we were trying to update an existing member type, this was something we had no problem doing on our development environment, but in our production environment we have encountered this issue
we are using 7.2.4 but have tried it with a copy of the lvie database and our local code.
we have tried looking at it against upgraded code
we do not plan on changing or needto change the member type again, so its a wrinkle rather than a show stopper for us at the moment
but it doesn't explain why when we run this we can update the membertype but within umbraco it throws a wobbly
is working on a reply...