locked
Getting the money datatype in C# RRS feed

  • Question

  • Hi forum,

    I am working on a data where i need to get the datatype in money. I have one stored procedure which returns number of columns where some are of money and smallmoney datatype like 'Price'. When I execute this stored procedure in Frontend to get the resultant data in datatable it converts its DataType into Decimal. I am accessing this Columns as

     

    foreach(DataColumn cols in sqldatatable.Columns)

    {

    if (cols.DataType.FullName == SqlDbType.Money.ToString())

    {

    MessageBox.Show(cols.ColumnName);

    }

    }

     

    I want to check out for all the datatypes in the Data table for its datatype and if its datatype is money then get the column name. but when i tried with

    cols.DataType == SqlDbType.Money

    it gives error for operands of type 'System.Type' and 'System.Data.SqlDbType' and after some goggle I got that Money, small money datatypes are converted to decimal in C#.

     

    But I want to get this datatype any how can anyone guide me as to how to accomplish it?

     

    Thanks in advanced,

    Priyadarshini

    Saturday, October 4, 2008 10:34 AM

Answers