Reading 39 digit number from excel sheet using c#
Excel cannot process data more than 64 bit (Big it will store it in powers of 10), but in our application I want 128bit data, for that I have formatted p开发者_如何学Carticular cell to be text format in excel sheet, so that I can enter very big number. Now I am able to enter big number, but not able to read that particular cell in code and also gives error for that cell. I am using OleDbConnection in C#.
You mention that it is some sort of card ID, which to me says it's a string rather than a true number.
But, if you really have to manipulate as an integer, have you looked at BigInteger?
BigInteger, GetFiles, and More
Update in response to comments: @Shashikiran: you seem to be treating the symptoms rather than the cause. Your real problem appears to be reading a string longer than 14 chars, when excel is treating the cell contents as a number rather than string (due to all numeric chars). Sounds like you need to tell Excel it's a string rather than a number, I believe you do this by pre-fixing with 'A'
Can you read that cell as a string and then convert it to a biginteger?
C# has no built-in 128-bit integer data type.
精彩评论