Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts

    formatting xls data types - .net

    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.
    does this sig match?

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Location
    France
    Posts
    522
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XmlConvert

    I don't know if this can help but you can try the XmlConvert class


    anyDouble = XmlConvert.ToDouble(anyData.ToString)
    Last edited by angiras; 09-10-2003 at 11:11 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •