HomeIndexAdminRss

CYQ.Data components

CYQ.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 5]-[MProc Execute Stored Procedures or SQL]

Guide | | | pubdate :2011/7/2 20:19:22#TopicOwner  

In this section:

continue on a content, this section describes MProc class-related operations.

 1: MProc execute stored procedure

 2: MProc execute SQL operations

I:Constructor

Method Prototype :
 
public MProc(object  procNamesEnum)

public MProc(object  procName, string conn)

Description:

Constructor and MAction usage of the relevant operating parameters can be MAction.

Example 1:Pass stored procedure name

//Stored procedure name passed in the default configuration items to take Conn database link
MProc proc
= new MProc(ProcNames.GetUserList);//Passing through the enumeration

Example 2:Pass stored procedure name and custom database link

 
//Into the database a new database link configuration items Conn
 
MProc proc = new MProc("GetUserList","ChatConn");

//Into the database directly link the new database link string
MProc proc = new MProc("GetUserList","Server=.;database=Chat;uid=sa;pwd=xxxxx");

//Multi-use agreement under the name of the database configuration items from ChatConn links
MProc proc = new MProc(P_ChatEnum.GetUserList);

Example 3:Pass SQL statement

Note: Only supported in V1.5 version of the above.
/ / Execute custom SQL statement, the default configuration items database link from Conn
MProc proc = new MProc("select * from Users");

/ / Execute custom SQL statements from the configuration items database link ChatConn

MProc proc = new MProc("select * from Users","ChatConn");

II:Parameterization

Method Prototype :
 
public void Set(object  paraName, object  value)

public void Set(object  paraName, object
  value,SqlDbType sqlDbType)

public void
Clear()

Example 1:

//As stored procedures or parameterized SQL statement to set parameters
proc.Set(GetUserList.ID, 888);//Enumeration method to pass

Example 2:

proc.Set(Users.ID, 888,SqlDbType.Int);//More than in the last example of a parameter.

Example 3:

proc.Clear();//Clear all Set parameters.

III:Execute Method Operation

Method Prototype :
 
public MDataTable ExeMDataTable() / / List of query

public int
ExeNonQuery() / / Add / Update / Delete

public T ExeScalar<T>
() / / Return a single value of the first row first column

Example 1:

MDataTable table = proc.ExeMDataTable();// return MDataTable

Example 2:

int result = proc.ExeNonQuery();//Insert, update, delete, return the number of rows affected.

Example 3:

string result = proc.ExeScalar<string>();//Statement is executed, returns the first row first column value.

IV:ReturnValue and DataBase Close

Method Prototype :

public int
ReturnValue

public void
Close()

Example 1:

MDataTable table= proc.ExeMDataTable();
int value = proc.ReturnValue;//
If the stored procedure is executed, the return value obtained by the total number of records.

Example 2:Close manually

MProc proc = new MProc(ProcNames.GetList);
MDataTable table
=
proc.ExeMDataTable();
int value =
proc.ReturnValue;
proc.Close();
//Close the database links after the implementation of

V:A complete example

Example

Examples of use:

Instantiation:            using(MProc proc
= new MProc(ProcNames.GetList))
                                        {
Add parameters:                      proc.Set(GetList.ID,
10
);
Access list:                              MDataTable table
= proc.ExeMDataTable();
Take the return value:           int count=proc.ReturnValue;

Bound control:                       
table.Bind(GridView1);
                                        }

Chinese version of the link:http://www.cyqdata.com/cyqdata/article-detail-415

More tutorials:

 



新浪微博粉丝精灵,刷粉丝、刷评论、刷转发、企业商家微博营销必备工具"
privatni[89.28.10.*]2020/11/25 6:44:20#121
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.
Greece villas for sa[89.28.10.*]2020/11/25 3:43:32#120
This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
real estate Greece f[89.28.10.*]2020/11/25 3:33:44#119
I truly appreciate this blog article.Really thank you! Cool.
Favourite Online Gam[89.28.10.*]2020/11/25 2:44:34#118
please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
party venue finder[89.28.10.*]2020/11/25 0:35:42#117
Really enjoyed this post.Really thank you!
Tattoo[89.28.10.*]2020/11/24 23:43:08#116
Really enjoyed this article.Really looking forward to read more. Great.
univerzitet[89.28.10.*]2020/11/24 21:50:00#115
poker bonuses What are the norms of copyright of web content? How as it different from Patent?
cosmética barat[89.28.10.*]2020/11/24 20:07:43#114
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?
Uzbekistan tours[89.28.10.*]2020/11/24 19:57:16#113
This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
Silicone chew toys[89.28.10.*]2020/11/24 18:43:16#112
I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.
Uzbekistan day tours[89.28.10.*]2020/11/24 9:59:10#111
It as difficult to find educated people on this topic, but you sound like you know what you are talking about! Thanks
Uzbekistan tours[89.28.10.*]2020/11/24 9:47:45#110
This is one awesome blog.Really thank you! Really Great.
go there now[89.28.10.*]2020/11/24 9:05:19#109
Really informative article post. Awesome.
direct link[89.28.10.*]2020/11/24 7:38:09#108
items, but still flexible enough to fish vs
get this deal[89.28.10.*]2020/11/24 6:11:31#107
Thank you ever so for you article.Really thank you! Really Cool.
����� 24[89.28.10.*]2020/11/24 4:45:11#106
whoah this blog is fantastic i love reading your articles. Keep up the good work! You know, many people are looking around for this information, you could help them greatly.
caretas con gafas[89.28.10.*]2020/11/24 3:19:26#105
Just what I was searching for, appreciate it for putting up.
brujos en linea[89.28.10.*]2020/11/24 1:55:22#104
Looks like these guys have plenty of outsourcing opportunities available.
this website[89.28.10.*]2020/11/24 0:29:56#103
You produced some decent factors there. I looked on the internet for the dilemma and located most individuals will go along with together with your site.
Jersey Face Masks Su[89.28.10.*]2020/11/23 23:06:18#102
My brother suggested I might like this blog. He was totally right. This post actually made my day. You cann at imagine just how much time I had spent for this information! Thanks!
kamagra online[89.28.10.*]2020/11/23 21:43:16#101
I really liked your post.Really thank you!
New York giants[89.28.10.*]2020/11/23 20:15:54#100
page dailly and get fastidious information from here daily.
stockhouse picks 202[89.28.10.*]2020/11/20 13:51:21#99
You got a very great website, Gladiola I found it through yahoo.
kurierdienste[89.28.10.*]2020/11/20 12:28:10#98
Lovely just what I was searching for.Thanks to the author for taking his clock time on this one.
get deal[89.28.10.*]2020/11/20 11:04:40#97
You made some really good points there. I looked on the web to learn more about the issue and found most people will go along with your views on this website.
amycoz[89.28.10.*]2020/11/20 9:38:57#96
You made some really good points there. I checked on the web to learn more about the issue and found most people will go along with your views on this site.
click here[89.28.10.*]2020/11/20 7:43:21#95
Keep up the excellent piece of work, I read few blog posts on this website and I conceive that your web site is really interesting and has got circles of great information.
go to[89.28.10.*]2020/11/20 7:28:08#94
Spot on with this write-up, I actually suppose this web site needs much more consideration. I all in all probability be once more to learn rather more, thanks for that info.
take a look at[89.28.10.*]2020/11/20 7:05:11#93
Lovely blog! I am loving it!! Will be back later to read some more. I am bookmarking your feeds also.
Outdoor projector en[89.28.10.*]2020/11/20 3:14:55#92
Wow, incredible blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, let alone the content!
https://jbhnews.com/[89.28.10.*]2020/11/19 23:03:54#91
This blog was how do I say it? Relevant!! Finally I have found something that helped me. Many thanks!
2020 best lithium st[89.28.10.*]2020/11/19 4:32:59#90
I truly enjoy examining on this internet site, it has got wonderful blog posts. Never fight an inanimate object. by P. J. O aRourke.
adyen bv etsy[89.28.10.*]2020/11/19 2:43:12#89
It as not that I want to duplicate your web site, but I really like the pattern. Could you tell me which theme are you using? Or was it tailor made?
tankless water heate[89.28.10.*]2020/11/18 3:45:58#88
Saved as a favorite, I love your website!
cheap panel[89.28.10.*]2020/11/18 2:06:47#87
You know so much its almost tough to argue with you (not that I personally
cheap panel[89.28.10.*]2020/11/18 2:05:50#86
It as nearly impossible to find well-informed people in this particular subject, however, you sound like you know what you are talking about! Thanks|
copy-trading crypto[89.28.10.*]2020/11/17 12:21:57#85
Really appreciate you sharing this article post.Really looking forward to read more.
decentralized exchan[89.28.10.*]2020/11/17 11:00:41#84
I truly appreciate this blog post.Really looking forward to read more. Cool.
crypto lending[89.28.10.*]2020/11/17 9:38:47#83
I went over this site and I conceive you have a lot of great information, saved to my bookmarks (:.
hive crypto[89.28.10.*]2020/11/17 8:17:12#82
Spot on with this write-up, I absolutely feel this site needs a lot more attention. I all probably be back again to read more, thanks for the information!
cotizar seguro quali[89.28.10.*]2020/11/17 6:22:51#81
It as onerous to find knowledgeable folks on this subject, but you sound like you realize what you are talking about! Thanks
crm en empresas peru[89.28.10.*]2020/11/17 5:52:17#80
lot and never manage to get anything done.
pastillas abortivas[89.28.10.*]2020/11/17 5:22:27#79
Thanks-a-mundo for the blog post.Really looking forward to read more. Really Great.
agen judi bola[89.28.10.*]2020/11/17 0:12:06#78
Say, you got a nice article post.Really looking forward to read more. Want more.
alquiler de carros e[89.28.10.*]2020/11/13 10:11:27#77
Thanks again for the blog article.Thanks Again. Great.
Home Theatre Mijia P[89.28.10.*]2020/11/13 8:46:11#76
Say, you got a nice blog post. Much obliged.
Maryland office move[89.28.10.*]2020/11/13 7:17:57#75
You have mentioned very interesting details ! ps decent internet site. virtual private server | virtual private server |
TV installation[89.28.10.*]2020/11/13 5:51:17#74
serenity malibu I am struggling with this problem, unknowingly i started importing other person blog posts..which i want to disable. Please help me out.
Commercial cleaning[89.28.10.*]2020/11/13 4:24:38#73
You have observed very interesting points! ps decent site.
Apartment movers[89.28.10.*]2020/11/13 2:50:59#72
Wow, fantastic blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is excellent, as well as the content!

Post Comment

:Register

Bulletin

    数据框架 CYQ.Data QQ群:6033006
    使用本框架进行开发,入门简单,开发效率高,性能优越,更有详尽的API文档,有相关的使用帮助文章、示例文章、更甚有相关的视频教程及辅助工具。 关键还是免费与开源,实在是居家旅行、项目开发、学习研究的必备良品!!!!!!


    在线帮助:欢迎联系

Article Search