Hi, I have a excel sheet contains three columns Name, Email ID and Contact No. I would like to read data from a excel data and check through my code that the Email ID column contains @ sign, Contact No should be of maximum 10 digits, I would like to do these types of validation. Please suggest.
+1
A:
Read up on the Interop.Excel namespace if you want to get data from Excel files.
If you want something a bit better than using Interop, I use GemBox.Spreadsheet. You'll want to use another library if it's something you need to deploy to a computer which doesn't have Excel installed.
You can use regular expressions to validate strings. Read up on the System.Text.RegularExpressions namespace to figure that one out.
A simple regular expression to check for at least one @ sign in a string would be: @"@"
To check that a string consists of exactly 1-10 digits: @"^\d{1,10}$"
mootinator
2010-10-26 04:14:53
+1
A:
Easier than interop, you may also use an OleDbConnection.
Here is an example
Johann Blais
2010-10-26 05:13:10
This is really a nice example...
sauravinfy
2010-10-26 06:42:57