How to write back to database from Silverlight?
I use LINQ to SQL to get data from a database and use a service开发者_开发知识库 contract to access it in Silverlight at the client side. I display the data in a DataGrid. Now how do I make sure that any changes in the datagrid is written back to the database?
EDIT:
This is the example code I implemented: http://www.silverlight.net/learn/tutorials/sqldatagrid-cs/
Here I wanted any change in the datagrid reflected back in the database.
The SubmitChanges function works in the DataContext object which is:
public partial class DataClasses1DataContext : System.Data.Linq.DataContext
But this is not exposed in the contract and so not visible in the client side code.
Did you try to use this command :
_myDomainContext.SubmitChanges();
If your want more information take a look on article :
"How SubmitChanges works in .NET RIA Servies" : http://weblogs.asp.net/fredriknormen/archive/2009/08/10/how-submitchanges-works-in-net-ria-servies.aspx
精彩评论