Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to log data error to a table in MSSQL. For example if email id is not matching a pattern, need to log to an exception table. Please give me best possible way to solve this issue.

What I have tried:

Need to know about the best possible ways to do it.
Posted
Comments
Dave Kreskowiak 13-Feb-16 12:04pm    
So what's stopping you? You never said where you want to catch this "error". Something like this is normally done in your application and is just a simple checking of the result of a query. If there is no match craft whatever "error" data you want and save it to a table of your design. What's the problem here?
tijojoseph1989 13-Feb-16 13:07pm    
In the table there will be multiple columns to be checked. So we need to capture all the errors.
Dave Kreskowiak 13-Feb-16 16:14pm    
What are you talking about? There's no enough detail about your algorithm or what you want to do to be able to make any suggestions at all.

Are you asking how to check an email address against the content of a few database columns? That's not an error. That's simply making comparisons and if the result is false, that's where you generate your message that says the email wasn't found. Do what you want with that message, like logging it to a database.

I STILL don't have clue what you're having a problem with.

1 solution

There is no such thing as "best" way to do it. However, I suggest you either implement a 3rd party logging tool like log4Net, for example, or just write your own code.

I prefer to write my own code. Create a class that you can pass exceptions to and have it write the error to a database table. It's pretty straightforward.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900