How to Retrive cal field from dataset

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have the following select statement in a dataset;

SELECT Invoice_no, SUM(Direct_Deposit * DirectDepositFee) AS
NumDirectDep
FROM invoice WHERE (Date_1 > ?) AND (Date_2 < ?)
GROUP BY Invoice_no, ElectronicDepositFee

This works fine.

I retrieve invoice# in code using

TotalCalsTableAdapters.InvoiceTableAdapter m_totals = new
ProgName.TotalCalsTableAdapters.InvoiceTableAdapter();
TotalCals.InvoiceDataTable TotRows =
m_totals.GetDataByDepposit_Direct(t_min, t_max);
TotalCals.InvoiceRow m_Rows =
(TotalCals.InvoiceRow)TotRows.Rows[0];
Int m_invoice= m_Rows.Invoice_no ;

This also works fine.

I try to recover my cal field in the next line using,

Double m_direct= m_Rows.NumDirectDep ;

This gives an error,

TotalCals.InvoiceRow does not contain a definition for 'NumDirectDep'

How do I retreive the value 'NumDirectDep'?
 
How do I retreive the value 'NumDirectDep'?

You can do it by ordinal, but I would look at your DataSet first and make
sure you have the definition set up correctly. It might be as simple as the
casing, but you may also be filling it "incorrectly" or have it completely
named incorrectly (or even missing). There are some provisions in the
DataSet framework code that protects users from themselves. Unfortunately,
they some times have their own bite.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
How do I retreive the value 'NumDirectDep'?

One more thing. Since everything, other than the SQL Statement, is drag and
drop, sometime rebuilding the DataTable in the designer is the best way to
get around issues once you have refined your application to the point you
understand it better.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top