![]() | CYQ.Data componentsCYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project |
CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
Guide |
|
|
| #TopicOwner |
In this section: continue on a content, all of this section to Insert , delete, Update , related operations.
1: Insert method to add data
2: Delete method to delete data 3: Update method to update data 一:Insert Operation Method Prototype:
public bool Insert()
public bool Insert(bool autoSetValue) public bool Insert(bool autoSetValue, InsertOption option) Example 1: using(MAction action = new MAction(TableNames.Users))
{
action.Set(Users.NickName, "cyqdata");//Non-UI Set Value action.GetFrom(txtUserName)//UI Set Value
if(action.Insert())
{
int id=action.Get<int>(Users.ID);//Back into the post-primary key ID
} } Example 2: using(MAction action = new MAction(TableNames.Users))
{
action.Set(Users.NickName, "cyqdata");
action.GetFrom(txtUserName) action.SetAutoPrefix("txt"); //Control prefix setting, you can set more than one action.Insert(true);//In addition to the assigned set, the other table fields automatically from Request ["txt field"] in value. } Another: SetAutoPrefix automatic prefix method Method Prototype : public void SetAutoPrefix(string autoPrefix, params string[] otherPrefix) More than one prefix can be set as an example: action.SetAutoPrefix("txt","ddl","lab"); Example 3: using(MAction action = new MAction(TableNames.Users))
{
action.Set(Users.NickName, "cyqdata");
action.GetFrom(txtUserName)
action.Insert(false,InsertOption.ID);//After insertion, have only been increased from ID } InsertOption Enumeration Description: /// <summary>
/// Option to insert the return value of the data /// </summary> public enum InsertOption { /// <summary> /// Use this: insert data [MSSQL will return ID, other databases will not return ID] /// </summary> None, /// <summary> /// Use this: Insert data returned ID. /// </summary> ID, /// <summary> /// Use this: insert data, based on the query to return ID after filling the data line. [Default] /// </summary> Fill, } 二:Delete Operation Method Prototype :
public bool Delete() public bool Delete(object where) Example 1: using(MAction action = new MAction(TableNames.Users))
{ action.Set(Users.ID, 1); action.Delete(); } Example 2: using(MAction action = new MAction(TableNames.Users))
{ action.Delete("id=1 or UserName='cyqdata"); } 三:Update Operation Method Prototype :
public bool Update() public bool Update(object where) public bool Update(object where, bool AutoSetValue) Example 1: using(MAction action = new MAction(TableNames.Users))
Example 2: using(MAction action = new MAction(TableNames.Users))
Example 3: using(MAction action = new MAction(TableNames.Users))
{
action.Set(Users.NickName, "cyqdata");
action.GetFrom(txtUserName);
action.SetAutoPrefix("txt"); action.Update("id=1",true); } Chinese version of the link:http://www.cyqdata.cn/cyqdata/article-detail-414 More tutorials: 1:CYQ.Data Components Getting Started Guide [Part 1] 2:CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select] 3:CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value] 4:CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update] 5:CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL] ![]() |
love anal[37.233.27.*]2017/3/5 6:23:35 | #8 | |
![]() | GuLerm What degree could I get involving music AND creative writing? |
Learn More[37.233.27.*]2017/2/1 23:10:43 | #7 | |
![]() | aK26av Spot on with this write-up, I really suppose this website needs much more consideration. I?ll most likely be again to read much more, thanks for that info. |
fiverr crorkservice[37.233.27.*]2015/11/9 19:46:22 | #6 | |
![]() | FlNlki Very nice post. I just stumbled upon your blog and wished to say that I have really enjoyed browsing your blog posts. In any case I will be subscribing to your feed and I hope you write again soon! |
crorkz matz[37.233.27.*]2014/8/6 8:16:15 | #5 | |
![]() | sGENtC Hey, thanks for the blog.Really thank you! Will read on... |
crorkz matz[37.233.27.*]2014/8/6 5:26:23 | #4 | |
![]() | mlh330 Really enjoyed this article.Much thanks again. Great. |
cheap backlinks[37.233.27.*]2014/7/19 6:46:55 | #3 | |
![]() | PYcAzl Im obliged for the blog article. Keep writing. |
the best seo service[192.162.19.*]2013/9/8 16:16:11 | #2 | |
![]() | lSb5nn Im grateful for the article post.Thanks Again. Fantastic. |
seo service[192.162.19.*]2013/9/6 6:46:07 | #1 | |
![]() | c1DKfM I appreciate you sharing this blog article.Much thanks again. |
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.