I have a form that has a table adapter for a table called costing. Im not using any of the items in this table in any textboxes etc.. on the form but I would like to use them in calculations that will give results to put in text boxes on these forms. I'm confused in how to call up the items in the costing table. If i use the name assigned to them in the table even thought the table is attached it does not seem to work.

I tried this:

totaldsgn = drawdsgnhrs (where drawdsgnhrs is the variable in the costing table)

Recommended Answers

All 2 Replies

The table adapter fills a dataset or a datatable, you should have the DataSet on the designer of your form and possibly a binding source.

Locate the tableAdapter.Fill, more than likely in your Form's load event. It will look like

taAdjustment.Fill(dsRptCashAdjust.Adjustment);

Now to access the data, you will make a call that looks like:

dsRptCashAdjust.Adjustment[0].NewBalance

The [0] is the row index, so choose which row you need. "NewBalance" is a table variable in my application, change it to the name of the variable in your application.

Watch out for DBNull's, if you attempt to access a variable that is a null value the application will throw an exception. You need to test with:

dsRptCashAdjust.Adjustment[0].IsNewBalanceNull()

Thanks SKnake.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.