c# - How to get the table name from the Exception(Reference) in .Net using MS SQL database -
my code -
try { currentpane.viewcontroller.delete(); } catch (exception ex) { try { /* -- need find expression getting table name -- */ string title = "deletebutton_click error " + contentpane.tabheader; if(ex.innerexception != null) messagebox.show(ex.innerexception.message, title, messageboxbutton.ok, messageboximage.error); else messagebox.show(ex.message, title, messageboxbutton.ok, messageboximage.error); var service = new insurablerisk.service.applicationexceptionservice(); try { service.save(ex); } catch { } { service.dispose(); service = null; } } catch { } } } while capture refrencial integrity exception in mvvm application, see table name in ex.innerexception.message
the delete statement conflicted reference constraint "fk_policy_insurancecarrier". conflict occurred in database "insurablerisk", table "dbo.policy", column 'insurancecarrierkey'. statement has been terminated.
but not able figure expression pull table name. pointers ?
Comments
Post a Comment