|
||
The following examples show how you can use the CMS.DataEngine library for low-level data manipulation.
|
Only for illustration
The code is used only for illustration. It's recommended that you use the CMS.SiteProvider.UserInfoProvider class for manipulation of the user data.
|
[C#]
using CMS.DataEngine; ...
SimpleDataClass userObj = new SimpleDataClass("cms.user"); userObj.SetValue("username", "johns"); userObj.SetValue("fullname", "John Smith"); userObj.Insert(); |
[C#]
using CMS.DataEngine; ...
SimpleDataClass userObj = new SimpleDataClass("cms.user", 10); string userName = (string) userObj.GetValue("username"); userObj.SetValue("fullname", "John Smith Jr."); userObj.Update(); |
[C#]
using CMS.DataEngine; ... SimpleDataClass userObj = new SimpleDataClass("cms.user", 10); if (! userObj.IsEmpty()) { userObj.Delete(); } |
You can run a custom query if you first create it either manually in the CMS_Query table or through the administration interface (if it’s supported for the chosen entity).
[C#]
using CMS.DataEngine; ... QueryDataParameters parameters = new QueryDataParameters(); parameters.Add("@UserName", "johns");
TypedDataSet ds = ExecuteQuery("cms.user.selectbyname", parameters); |