Got this error in my Hand Created Controller. Never seen this in COT. My experience tells me that there is an issue Column Names (Which I have checked) and or Identity property being set in the database, which I have turned on for this table's PK.
Any Ideas on where to look and fix this. I'm not using any custom code, just ActionGroups that COT has built in.
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.


-
I am getting this error, and in my case it is caused by:
A. Having computed field that is not set to ready only, and COT tries to update.
In my case, I use computed field to hang searchable lookups off, then copy the values to other fields, and don't need to save the selected value otherwise.
Now I'm not sure if that's a bug in COT, or how I'm using it, but you can see the query it generated - it tries to update a literal value that does not exist in the table.
Hopefully that helps a bit. BTW, I traced the error to method:
ActionResult IDataController.Execute(string controller, string view, ActionArgs args).
To fix, I'll just create that field in my table, which I preferred not to..
pat.
-
-
Sure. If you don't have SQL Server developer/standard/enterprise,I use AnjLab SqlProfiler, it's a free download.
Make sure your non-standard fields are set to readonly, otherwise COT tries to write back to them (with dodgy SQL), hence this error. I get this error often for a few different scenarios.
Pat. -
-
Hang on I'll check my crystal ball.. f#$k it's broken. No idea. For that view you get the error, check all your fields, it should be obvious, you must have a computed field or mismatch with your SQL! :)
Pat. -
-
Hi Pat,
I have a virtual field which does not exists in the databaese and that has the option "The value of this field is computed at run-time by SQL expression" ticked wit hvalue NULL. This is what i am getting the SQL statement. It was working well until I add new field in the database table and refreshed the metadata.
any idea. I tried making the field readonly and still getting the error. -
-
I think until COT looks at this you will need to add a column to your table.
-
-
Hi Zakaria, I don't make use of, or know much about virtual fields.
I thought setting it read-only would have fixed this.. might have to wait for COT to look at this one .
Pat. -
-
Hi Pat. Thanks for looking into this. I must admit you are the best. I appreciate your continuous support.
Is your problem solved? Are you going to open a support ticket? -
-
Hi Zakaria,
No probs. Not sure if I'm the best (maybe 2nd best lol) :))
I think I created this as a field in the database -it's the only way to fix this error and make it work - basically , if you have an editable field, COT requires that a real field be in the table.
Regards,
Pat. -
-
Hey Zakaria, I ran into this issue again, and I realised a trick you can use.
From this document here: http://codeontime.com/Documents/Many-...
At the bottom, you can set the field to " fieldName.Modified=false" this prevents COT from updating the field in the database, which prevents that error.
pat.- view 1 more comment
-
-
Thanks for posting this. I had the same issue and successfully used "fieldName.Modified=false" too.
-
-
Where do you put this reference?
-
-
-
Would really appreciate your help.
Controllers.vb
Function: ConfigureCommandForInsert
Expression: DirectCast(command,System.Data.SqlClient.SqlCommand).CommandText
"SPKCd_Enrolled"
,"LastYearOfEnrolment"
,"SPKCd"
,"EnteredBy"
,"EnteredOn"
,"CurrentUser"
,(NULL))
values(
@p0
,@p1
,@p2
,@p3
,@p4
,@p5
,@p6)