c# - Is it possible to let linq to sql auto submit my new records back to database? -


i using linq sql , , return queryable result linq sql :

var qry = p in table select p; 

then use bind xtragrid:

gridcontrol.datasource = qry; 

then if edit records in xtragrid, need call datacontext.submitchanges() submit changes database.

my question :

am possible add new records qry result, , after need call datacontext.submitchanges(), linq can create new records on database automatically ?

is possible ? can point me right direction ? in advance !

shot answer no. need call add method on table property on context.

something this:

var qry = p in mydatacontext.table select p;  gridcontrol.datasource = qry;  mydatacontext.table.add(newrecord); // how add new recrod  datacontext.submitchanges(); 

read more here: http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -