C # Notes for using executereader to return datareader with both query result set and output parameters or return values

Source: Internet
Author: User

The command object exposes several execute methods that can be used to execute the required operations. When returning results in the form of data streams, you can use executereader to return the datareader object. You can use executescalar to return a single value. Executenonquery can be used to execute commands that do not return rows.

When you use a command object for a stored procedure, you can set the commandtype attribute of the command object to storedprocedure. When commandtype is storedprocedure, you can use the parameters attribute of command to access input and output parameters and return values. The parameters attribute can be accessed no matter which execute method is called.However, when executereader is called, the return value and output parameters cannot be accessed before datareader is disabled..

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.