Opened 9 years ago

Last modified 8 years ago

#1500 assigned defect

Duplicate cooperator throws wrong error message

Reported by: dbmuqs Owned by: Kurt Endress
Priority: medium Milestone:
Component: Middle Tier Version: N/A
Severity: Keywords:
Cc: Database Engine: N/A
Operating System: N/A

Description

When a user tries to update a cooperator and the update creates a duplicate on the key columns the unique index is violated but the error message says 'Update failed, it is not possible to delete from the cooperator table'. Error message needs correcting.

Change History (2)

comment:1 by Pete Cyr, 9 years ago

Owner: changed from Pete Cyr to Kurt Endress
Status: new → assigned

The Curator Tool only reports the error message coming back from the Middle Tier. The MT is giving the CT the wrong message.

comment:2 by Kurt Endress, 8 years ago

Component: Curator Tool → Middle Tier

This code is in SecureDate.cs. It could probably be removed since SQL server can handle the delete now.

try {

affected = dm.Write(cmd);

} catch (SqlException exSqlServer) {

HACK HACK HACK Sql server doesn't allow deleting from a table with > 253 foreign keys pointing at it
(aka cooperator table). Eat this unfriendly error and throw a nicer one.
if (exSqlServer.ErrorCode == -2146232060 && fmt.TableName.ToLower() == "cooperator") {

try {

throw Library.CreateBusinessException(getDisplayMember("doSave{cannotdelete}", "It is not possible to delete data from the {0} table.", fmt.TableName));

} catch (Exception exSqlHack) {

ex = exSqlHack;

}

} else {

ex = exSqlServer;

}

} catch (Exception exUpdate) {

ex = exUpdate;

}

Note: See TracTickets for help on using tickets.