Link to home
Start Free TrialLog in
Avatar of ianinspain
ianinspain

asked on

500pts: Extracting data from a table object?

Hi..

Can anyone help, I seem to be having a problem getting data from a table.. I have a table and if i do

? myData.Table.Rows.Count

I get 1, so data is there...

I have tried various things like

I tried myData.Table.Columns["TOTAL"]

but there is no property VALUE for example...

Can anyone suggest what i am doing wrong?

Thanks in advance

Ian


Avatar of apresto
apresto
Flag of Italy image

Hi ianinspain,

what object is myData : DataTable, DataTableCollection?

Apresto
SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ianinspain
ianinspain

ASKER

Thanks gauthampj,

That sort of works.. I get this

? myData.Table.Rows[0]["BO"]
{130.1}
    System.ValueType: {System.Double}
    Epsilon: 4.94065645841247E-324
    m_value: 130.1
    MaxValue: 1.7976931348623157E+308
    MinValue: -1.7976931348623157E+308
    NaN: NaN
    NegativeInfinity: -Infinity
    PositiveInfinity: +Infinity

But i really need just the value, i did try ToString but that didn't give the details either...

myData.Table.Rows[0][0].ToString(), this should give you the first value in the first column
If it has value then , I think there may not be any column named "TOTAL"
No it works... but doing ToString doesn't give me the value..

U mean myData.Table.Rows[0][0] has value, but
myData.Table.Rows[0][0].ToString() throws error, rite?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks BBK, yes i did try this... here is what i get.... If the column is a string then no probs....  But my column is a Double

? response.Data.Tables[0].Rows[0][1]
{0.0}
    System.ValueType: {System.Double}
    Epsilon: 4.94065645841247E-324
    m_value: 0.0
    MaxValue: 1.7976931348623157E+308
    MinValue: -1.7976931348623157E+308
    NaN: NaN
    NegativeInfinity: -Infinity
    PositiveInfinity: +Infinity
? response.Data.Tables[0].Rows[0][1].ToString
<overloaded>
    ToString: ((System.Double)((response.Data.Tables[0].Rows[0].get_Item(1)))).ToString+0 // method+offset
    ToString: ((System.Double)((response.Data.Tables[0].Rows[0].get_Item(1)))).ToString+0 // method+offset
    ToString: ((System.Double)((response.Data.Tables[0].Rows[0].get_Item(1)))).ToString+0 // method+offset
    ToString: ((System.Double)((response.Data.Tables[0].Rows[0].get_Item(1)))).ToString+0 // method+offset
ahh .. thnaks.. I got it

Double.Parse( response.Data.Tables[0].Rows[0][1].ToString())