Use the enterprise database to call the stored procedure and accept the return value

Source: Internet
Author: User

String SQL = "movedata ";
Mcmd = dB. getstoredproccommand (SQL );
DB. addinparameter (mcmd, "@ State", dbtype. int32, 2 );
DB. addparameter (mcmd, "@ RET", dbtype. byte, parameterdirection. returnvalue, "", datarowversion. Default, null );

Mcmd. Parameters ["@ RET"]. Value

1. Add Parameters

 
Public voidAddparameter(Dbcommand command, string name, dbtype, parameterdirection direction, string sourcecolumn, datarowversion sourceversion, object value );

DB. addparameter (mcmd, "@ return", dbtype. byte, parameterdirection. returnvalue, "", datarowversion. Default, null );

DB. addparameter (mcmd, "@ return", dbtype. byte, parameterdirection. returnvalue, null, datarowversion. Default, null );

Note: The second parameter name must be @ variable name. Otherwise, the system automatically adds

Parameterdirection. returnvalue specifies the return value.

2. Run

DB. executenonquery (mcmd );

3. Values

Dbtype. byte x = mcmd. Parameters ["@ return"]. value;

From: http://www.cnblogs.com/zfh424/archive/2009/02/03/1383507.html

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.