Operate data tables on the front-end interface

Source: Internet
Author: User

I learned how to operate data tables on the front-end interface this week.

1. Mind Map

 

Ii. Knowledge POint Description

Frontend and backend interfaces are required because front-end pages only provide views and NO content, while the backend only provides content, it is to place the back-end content on the reserved position of the front-end page.

 

Both use the datagridview Control

    • Executenonquery, which calls the SQL command, to execute the command, write data to the database, and return the number of affected rows;
    • Capture SQL exceptions. If the SQL exception number is 2627, the primary key/unique constraint is violated, that is, the duplicate value is inserted;
    • The stored procedure calls the SQL connection method createcommand to create an SQL command. This command is bound to an SQL connection. It specifies the command Text of the SQL command. The command text is the name of the stored procedure; set the SQL command type to Stored Procedure
    • The dategridview control is also used for deletion.
    • Update record: Call the SQL command method executereader to execute the command and obtain the data reader. Call the data reader method getordinal to obtain the corresponding index values of each column. Also, use the datagridview control.
    • Query records: Call the SQL command method executereader to execute the command and obtain the data reader. Call the data reader method getordinal to obtain the corresponding index values of each column. The data table also uses the datagridview control.

Step 1: Database Connection

I am using code to connect to the database. below is my code content.

 

 

The second part is data input.

 

 

Then the running result is displayed, indicating that the data is successfully input.

 

 

Operate data tables on the front-end interface

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.