1. Add ADO. NET Entity model ing to a table in the WEB Project
2. Add the domainservices class and select enableedit to automatically generate insert update Delete.
3. You can write the query method in domainservices .. For example, add a where (a => A. Name = "zmj ")
4. Note that you must compile each step.
5. datacontent. Load (datacontent. getusersbyname ("zmj"); query
6 propertychanged event: propertychanged + = new system. componentmodel. propertychangedeventhandler (datacontent_propertychanged );
Public void datacontent_propertychanged (Object sender, system. componentmodel. propertychangedeventargs ARGs)
{
VaR list = from u in datacontent. Users where u. Name = "zmj" select U;
Foreach (var u in List)
{
_ Objuser = u;
}
This. label1.text = _ objuser. ID;
}
This is because the RIA service load data is asynchronous. This event is equivalent to a monitoring event. When the data changes, the operation is completed. If you still want to do the following: 1. Fetch data 2. Assign data to the UI.
Because when you do step 2, You Can Do step 1. This is the biggest headache for new contacts.
7. Update:
_ Objuser. ID = "321 ";
Datacontent. submitchanges ();