While trying to add value into foreign key field, if same data doesn’t exist in primary key field it throws exception like “An error occured while updating entries.” However, i want to catch the same exception and display it in some window with message like “Value doesn’t exist, please enter different value.” So how can i catch this error in asp.net MVC.
Share
not really familiar with MVC, I use WinForms, but why not try to find out the error code you get. Just put your code in a try catch block and if an exception is thrown check if the error code matches your error code and if it does use a MessageBox or something like that to show your message.
Hope this helps