Introduction to ASP.net Web matrix development tool

Source: Internet
Author: User
Tags microsoft website

asp.net Web matrix is Microsoft's latest ASP.net programming tool, which features a comprehensive, lightweight and flexible use. Let's now look at how this tool is designed to combine data with pages.

I. Establishment of a database

asp.net Web matrix now supports Microsoft's SQL Server, as well as a simple desktop database with MSDE, a simple database that is similar to the personal version of SQL Server and can be downloaded for free. To illustrate the use of this database, we first download this free database tool to the Microsoft website.

Without the above database installed, the data panel of the ASP.net web matrix does not have a database (figure I), and in the ASP.net web matrix, when the user clicks the "Data" tab, asp.net the web The matrix will give a hint to install the database

At this point, we can install the SQL Desktop database or download the Microsoft MSDE database for free. When the installation is complete, we can set up the data table in the local database or the remote SQL database server, and then do the asp.net to the data.

After you install MSDE, you can set up your database by clicking the "Data" panel of the ASP.net Web Matrix again.

Because the way you build and manipulate the database is the same as using SQL Server security, we don't go into detail here, where we build a database called Orders

After the above settings, the ASP.net Web matrix can be a smooth operation of the database, the following procedures we will be for the above database, datasheet to operate. Users using SQL Server, install desktop SQL Server locally can directly connect to the remote database, the general personal application or learning to use, directly with Microsoft's MSDE can fully meet the requirements, after all, SQL Serer price and management are not individual users can easily achieve.

Ii. operation of database with ASP.net

After the establishment of the database, we can do the database operation, we will be divided into several types of database operations, and strive to comprehensively introduce the essence of the ASP.net Web matrix database operation.

1. Simple Data release

We know that the simplest and most basic database operation is the publication of data table information. Here, we first publish the Orders table information of the orders database above to the Web page simply through asp.net.

In the ASP.net Web matrix, MxDataGrid server controls are data table controls that specifically display data sources such as databases, and we can bind controls to data sources to display data when the design or program is run, where We use the MxDataGrid server control to display the data.

(1) in the ASP.net Web matrix, select "File"-> "new", the "New File" dialog box appears;

(2) In the dialog box that appears, select the "General" panel;

(3) Select "ASP.net Page";

(4) Enter the newly established file path in the "Location" input box;

(5) Enter the newly created filename "myfirstdatagrid.aspx" in the "filename" input box;

(6) Select "Visual Basic" as the ASP.net development language in the "Language" drop-down box;

(7) Click on "OK" button;

(8) In this way, the file "Myfirstdatagrid.aspx" will appear in the "design" view of the ASP.net Web matrix

(9) Select the "Data" option page in the work window;

(10) Click on the top of the page of the database logo, the database selection interface, here we select the local "Orders" database.

(11) Return to the Work window, select the "Orders" table, with the left mouse button click on the table, drag it to the ASP. NET page;

(12) So, in Design view, we will see that Sqldatasourcecontrol and MxDataGrid two controls appear on the ASP.net page

Here, we pay attention to a few points, one is the ASP.net web Matrix tool to specify the database automatically set Sqldatasourcecontrol properties; The second is that the ASP.net Web matrix will automatically MxDataGrid and Sqldatasourcecontrol binding;

(13) Save and run this file, we just designed the myfirstdatagrid.aspx will automatically display in the browser, this page contains all the Orders table data, if the data in the database more than 10 lines, MxDataGrid will display 10 lines per page and automatically paging the data, the page will appear in the page of the link;

Through the above operation, the data table Ordrs content automatically through the Web page, the above steps look a lot, in fact, the specific design, it will be very simple. In this simple program, we do not need to write a line of code to create an automatic pagination of the data publishing page.

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.