When doing a Web project, there may be most of the time to add, modify, and delete the database. Every Asp.Net people know the DataGrid control, only a small amount of code can display, modify, and delete a data table. So I think about how I can implement similar to the DataGrid control in the ASP. So spent a few nights to do this ASP DataGrid control.
Basically imitate the DataGrid function, just create a new page, then reference the DataGrid control, set a few lines of code, you can display any database table, page display, add, modify, delete. And support the data in the primary table when you join a plurality of tables. The whole process takes only a few minutes.
The main function of the control:
1. Quick display data: Simply set a few parameters, you can display a database table in the new page, and there are a variety of styles to choose.
2. Page function: Optional function.
3. Add, modify, delete data: Optional function. These three methods can be automatically implemented.
4. A variety of styles optional: provide a variety of DataGrid style.
The main function of the control:
1. Quick display data: Simply set a few parameters, you can display a database table in the new page, and there are a variety of styles to choose.
2. Page function: Optional function.
3. Add, modify, delete data: Optional function. These three methods can be automatically implemented.
4. A variety of styles optional: provide a variety of DataGrid style.
Demo:
1. Connect DataGrid.asp and database Conn.asp in the Directory of the Web Project
2. Create a new COMPUTER.ASP page, create a new database Test.mdb, add a computer table
3. Edit Computer.asp
4. At this time, DataGrid is set, and then run Computer.asp.
4.1 Initial Interface
4.2 Add data
4.3 Editing data
4.4 Changing the style (strStyletype = 2)
4.5 Page (ISPAGINATION = 1; PageSize = 2)
4.6 Turn off the data editing function (iSEDIT = 0)
5. The above is an example of a single table, and DataGrid.asp also supports the display of the main slave table, and modifies the primary table data. The following figure is an example of a master from the query, where the category is from the table, you can use Combox display Data, and choose.
Conclude
The program is written, but only the basic functionality has been implemented. However, it is indeed possible to make the database development faster. If you are interested, you can discuss together, DataGrid.asp's code can share it, everyone fully improves the functionality. thanks for reading!
Require source code, please leave an email