Paolo_R (4) [Avatar] Offline
#1
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()
{
InitializeComponent();

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.

Thanks
fabrice.marguerie (224) [Avatar] Offline
#2
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
#3
Re: Update table with LINQToDataSets
Fabrice: thank you. I had reached the same conclusion after much research.
Paolo_R (4) [Avatar] Offline
#4
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
#5
Re: Update table with LINQToDataSets
OK, figured it out:

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

then

transDAdapt.Update(dataSet.Transaction);