The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Paolo_R (4) [Avatar] Offline
I'm new to LINQToDataSets so apologies if this is a dumb question.

I have a typed dataset created thus in VS 2008:

public frmMain()

new ExpenditureTableAdapters.TransactionTableAdapter().Fill(dataSet.Transaction);
new ExpenditureTableAdapters.PayeeTableAdapter().Fill(dataSet.Payee);
new ExpenditureTableAdapters.CategoryTableAdapter().Fill(dataSet.Category);
new ExpenditureTableAdapters.SubCategoryTableAdapter().Fill(dataSet.SubCategory);

I have an input form comprising controls such as combo boxes (via which I am grabbing data from the Payee, Category and SubCategory dataSets) and a DateTimePicker from which I am inserting the data into variables.. I need to 'combine' these various input data to form a 'record'/row which I then want to add to the Transaction dataSet.

I'm not sure how to do this so an example would be appreciated.

fabrice.marguerie (224) [Avatar] Offline
Re: Update table with LINQToDataSets
You would do this with standard DataSet code. LINQ to DataSet helps you only to query data that exists in a DataSet and does not help you when you need to add data to a DataSet.
The only thing in LINQ to DataSet that relates to data updates is the AsDataView query operator. See chapter 14 for more information on this.
Paolo_R (4) [Avatar] Offline
Re: Update table with LINQToDataSets
Fabrice: thank you. I had reached the same conclusion after much research.
Paolo_R (4) [Avatar] Offline
Re: Update table with LINQToDataSets
Given the code I have quoted...

new ExpenditureTableAdapters.TransactionTableAdapter().Fill(dataSet.Transaction);

... how would I express the code to call the Update method?
Paolo_R (4) [Avatar] Offline
Re: Update table with LINQToDataSets
OK, figured it out:

ExpenditureTableAdapters.TransactionTableAdapter transDAdapt =
new ExpenditureTableAdapters.TransactionTableAdapter();