posted 4 years ago
Welcome to CodeRanch, Sohel Jaman!
I added code tags to your post so that it is more easily to read. Next time, please add them yourself like [code]this[/code], and use the "Preview" button to see if everything looks nice before you submit your post.
You're likely not getting an error message because you're silently catching exceptions. NEVER have an empty catch block.
You're mixing presentation code with database access code. You shouldn't be accessing databases directly from your event handlers. Instead, create a class that encapsulates your database operations, and when an exception is thrown, wrap the exceptions in more appropriate ones, which you can then handle in your event handlers:
Your form can then look something like this: