View Full Version : formatting xls data types - .net

09-10-2003, 09:00 PM
I am importing an excel file into a dataset. Everything is working fine except I have one column that excel has defined as a double datatype. So if there is a field in this column with a value of "U7888" it will be null (in the dataset). Most of the fields in this column are numeric but some have letters in them. So in my sql to pull the data from excel I am trying to convert this column to a string.

"SELECT Convert(CHAR(25),[Policy Number]) as PN FROM SSR"

It will crash when doing this. Does anyone have any wisdom on converting data types from excel? I did go into excel and changed the format of this column to "general" but when it is being imported it still is a double.

09-10-2003, 10:01 PM
I don't know if this can help but you can try the XmlConvert class

anyDouble = XmlConvert.ToDouble(anyData.ToString)