Example code for executing stored procedures in C # and populating the results into the GridView

Source: Internet
Author: User
This article mainly introduces C # to execute stored procedures and populate the results of the GridView method, combined with an instance of the C # stored procedure operation and the GridView control related operations skills, the need for friends can refer to the following

This article describes a method that C # executes stored procedures and populates the results to the GridView. Share to everyone for your reference, as follows:

Selectsql sq = new Selectsql (); SqlConnection conn = new SqlConnection (SQ.LC); Conn. Open (); SqlDataAdapter rd = New SqlDataAdapter ();D ataset ds=new DataSet (); SqlCommand sqlcom = new SqlCommand ("DBO.SELECTJF", conn); sqlcom. Parameters.Add ("@name", sqldbtype.varchar,20). Value = nametext.text;sqlcom. Parameters.Add ("@sfzh", sqldbtype.varchar,30). Value = Sftext.text;sqlcom.commandtype = Commandtype.storedprocedure;rd. SelectCommand = Sqlcom;rd. Fill (DS); Gridview1.datasource = ds; Gridview1.databind (); Conn. Close ();d S. Dispose (); Rd. Dispose ();
Related Article

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.