Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

sql server 2008 - I am getting persistent but intermittent "Violation of PRIMARY KEY constraint" Errors -


i person in company tries solve coldfusion errors , bugs. daily emails full details of coldfusion errors etc, store information in our database.

and few different applications in coldfusion, seem sporadically generated "violation of primary key constraint" errors.

in code check existence of row in database before try insert, , still generate's error.

so thinking is, either need cftransaction around these each of check, insert or update blocks. not sure solve problem.

these coded in standard coldfusion style/framework. here example in pseudo-code.

cfquery name="check_sometable" datasource="#dsn#" select id sometable /cfquery

if check_sometable.recordcount gt 0 -do insert else -do update /endif

so why intermittently, cause primary key violations?

is sql server problem, missing configuration option?

are getting of because not on latest hotfixed version of coldfusion 8 standard?

do need upgrade our jdbc/odbc drivers?

thank you.

sounds race conditions me. 2 connections check next available id @ same time, same 1 , insert fails on second one. why not using identity field create pk if surrogate key?

if have pk natural key, violation thing, have 2 users trying insert same record not want. try fail gracefully though, error says else has created same record. , ask if want update after loading new values screen. i'm not sure want set data automatically updated second person without them seeing first person put database.

further might indication natural key not unique think is. not sure application does, how 2 people want working same data @ same time? if natural key company name, aware not guaranteed unique , might have users overwriting data 1 company data company already. i've found in life there few unique, never changing natural keys. if natural key isn't unique, may have bad data , pk violations symptom of differnt problem not real problem.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -