none
Issue related to fetching data from SQL of Column having dataType numeric(38,20) RRS feed

  • Question

  •            Hello,

           I have an issue in which I am binding a table from sql by executing query

    "select * from test"

    in this table the data are in this format :

    Id            Name                        Details
    1            dinesh                 987654312.00000000000000000000
    2            sandeep              987654312.00000000000000000000
    3             neha                  987654312.00000000000000000000
    4             sunil                  987654312.00000000000000000000

    but wen i am binding it then its displaying error as
    "The numerical value is too large to fit into a 96 bit decimal."


    The Datatype of columns of Table is as follows:-
    Name       DataType               Allow null
    Id             nchar(10)                Checked
    Name       nchar(10)                Checked
    Amount    numeric(38, 20)       Checked

     Code which I have written is as follows:-

    Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(tmpquery, ConnectionString)
    Dim dt As New DataSet
    da.Fill(dt)
    Even its not complusory whether its will a slect statement even can be a stored procedure producing such a column.
    So please help, how can i normally bind this type of column of sql in .net ....
       
    • Moved by Paul Zhou Wednesday, September 28, 2011 8:51 AM (From:.NET Platform Architecture Development Discussions)
    Monday, September 26, 2011 12:38 PM

Answers

All replies

  • System.Decimal Type of Ado.net can store value upto [79228162514264337593543950335].(28 digit)

    As your value is more than what you mentioned,You need to use somthing as BigDecimal.Frankly speaking there is no BigDecimal suported by .net [.Net 4.0 is having BigInteger] but you have many option for that,

    Option1.

     F# has BigDecimal Type.you can import F# System.Math Lib in to your project and Change your DataTableColumnType as BigDecimal and Fill DataTable.

    Option2.

    CodePlex has a BigDecimal Class Implemention.You can get that and change your code acording to that i mean

    Dataset1.Table[0].Column["ColName"].ColumnType=typeOf(CodePlexBigDecimal);

    And than Fill your Datatable.

    http://bigdecimal.codeplex.com/

    Mostly Us Finance Calculation are not more than 20 digit decimal value so i am not sure for what you need such a big decimal value


    Lingaraj Mishra
    Tuesday, September 27, 2011 8:45 AM
  • Hello;

     

       Then you want to say that .net 2.0, 3.0 or 3.5 doesnot support this datatype of SQL for retrieving data.

    Is it not possible to fill a dataset in this kind of scenario?

    Tuesday, September 27, 2011 12:35 PM
  • Move this thread to DataSet forum to get better support.

    Have a nice day.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 28, 2011 8:51 AM
  • Hello,

    It looks your question was like this one. I dealed this question here. http://social.msdn.microsoft.com/Forums/pl-PL/adodotnetentityframework/thread/fb1da551-2195-49d5-9745-0aeec241c372 Please double check it.

    Thanks,


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Wednesday, October 5, 2011 5:04 AM
    Wednesday, September 28, 2011 2:27 PM