Monday 8 December 2014

Filter datagridview from Datatable using LinqtoDataset, save the result

I got a situation where I have datagridview where its bindingsource is datatable from typed-dataset.

I want to make filter on 3 column, then add row to it.

I used this way

Filter the table and put the result in datagridview
Dim erc_Customer As EnumerableRowCollection(Of ds_northwind.CustomersRow)

erc_Customer = From t In Ds_northwind.Customers Where t.CompanyName.Contains("ou"Select t

dim dt as new ds_northwind.CustomersDataTable
dt.Merge(erc_Customer.CopyToDataTable)
bsCustomers.DataSource = dt

That for adding new Customer Row
bsCustomers.AddNew()

Save the new row
bsCustomers.EndEdit
taCustomers.Update(bsCustomers.DataSource)

No comments:

Post a Comment