Can you update/add records in SQL using a datagridview and LINQ to SQL

Posted by Jordan S on Stack Overflow See other posts from Stack Overflow or by Jordan S
Published on 2010-04-08T14:40:38Z Indexed on 2010/04/08 14:43 UTC
Read the original article Hit count: 415

Filed under:
|
|

Is it possible to bind a DataGridView to a LINQ to SQL class so that when I make changes to the records in the datagridview it automatically updates the SQL database? I have tried binding the data like this but if I make changes to the data in the datagrid view they do not actually affect the data in the database...

        BOMClassesDataContext DB = new BOMClassesDataContext();
        var mfrs = from m in DB.Manufacturers
                   select m;

        BindingSource bs = new BindingSource();
        bs.DataSource = mfrs;
        dataGridView1.DataSource = bs;

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about datagridview