Parameters in the Stored Procedure automatically generate function parameters, and columns in the table automatically generate the function parameter codesmith template.

Source: Internet
Author: User
I think everyone has this experience in the project. A stored procedure has a large number of parameters, and a large number of repeated parameters must be written when writing a function. Code And switch back and forth between SQL and vs to view the parameters. The same is true for data tables. Therefore, we have written two templates to accelerate development efficiency, the template can be used with slight modifications according to your own habits.
An example of a stored procedure is as follows:
Create procedure [DBO]. [createupdatedelete_newsarticleentity]
@ Dataaction int,
@ ArticleID Int = 0,
@ Sortid int,
@ Title varchar (100 ),
@ Source varchar (50 ),
@ Author varchar (50 ),
@ Topnews bit,
@ Description text,
@ Hitrate int,
@ Adddate datetime,
@ Lastupdate datetime,
@ Editor varchar (50 ),
@ Userid int,
@ Visible bit,
@ Openread bit,
@ Keyword varchar (100 ),
@ IMG varchar (50)
The generated code is as follows:
Sqlparameter [] _ Param = {
Sqlhelper. makeinparam ("@ dataaction ",""),
Sqlhelper. makeinparam ("@ ArticleID ",""),
Sqlhelper. makeinparam ("@ sortid ",""),
Sqlhelper. makeinparam ("@ title ",""),
Sqlhelper. makeinparam ("@ source ",""),
Sqlhelper. makeinparam ("@ Author ",""),
Sqlhelper. makeinparam ("@ topnews ",""),
Sqlhelper. makeinparam ("@ description ",""),
Sqlhelper. makeinparam ("@ hitrate ",""),
Sqlhelper. makeinparam ("@ adddate ",""),
Sqlhelper. makeinparam ("@ lastupdate ",""),
Sqlhelper. makeinparam ("@ Editor ",""),
Sqlhelper. makeinparam ("@ userid ",""),
Sqlhelper. makeinparam ("@ visible ",""),
Sqlhelper. makeinparam ("@ openread ",""),
Sqlhelper. makeinparam ("@ keyword ",""),
Sqlhelper. makeinparam ("@ IMG ",""),
};
Template download/files/shoucao/shoucao.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.