Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to import data from the excel. Data in one column of my excel contains both the alphanumeric and numeric only. But numeric only cell value can't be read. I mean only null value is entered in the db's table field. Guide me to fix it. I'm using VS2005 , C# , SQL server 2000.
Posted

1 solution

1) Start by reading the excel file
2) foreach value in the column check if this value is numeric

you could use something like this:

C#
public bool isNumeric(string val, System.Globalization.NumberStyles NumberStyle)
{
    Double result;
    return Double.TryParse(val,NumberStyle,
		System.Globalization.CultureInfo.CurrentCulture,out result);
}


3)afterwards you can process the value depending on if it's numeric or not
 
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