I am using linq to sql , and I return a queryable result from linq to sql :
var qry = from p in table select p;
Then I use this to bind to a xtragrid:
GridControl.DataSource = qry;
Then If I edit the records in xtraGrid, I just need to call
dataContext.submitChanges() to submit the changes back to database.
My question is :
Am I possible to just add new records into the qry result, and after that I only need to
call dataContext.submitChanges(), then linq can create new records on database automatically ?
Is that possible ?
Can someone point me the right direction ?
Thanks in advance !
Shot answer would be no. You need to call the Add method on the table property on your context.
Something like this:
Read more here:
http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx