Understand the DropDownList edit data source in ASP. NET, bind database data.

Source: Internet
Author: User

I. Understanding ASP. NET Binding Database

Finally learned the connection database part of the content, Yang Zhengko teacher video looks very easy, if the HD version is more OK.

I found that I learn a new programming language will have a feature, all want to quickly learn the database, data is everything, have the data to operate all the reasons for it. Now it's very reassuring to be able to connect to databases. Record the process and become part of the learning trajectory.

Environment is VS2013, MSSQLSERVER (2012)

(a) I want to achieve the effect is: a drop-down menu DropDownList, from the database to get data from the side, displayed in the Order menu.

(ii) the process of realization

First, I've already built the database and the data sheet, as shown in.

1. Create a new Web Form file dropdownlist-sql.aspx

2. Drag a DropDownList control and select Edit Data source

Procedures for configuring data sources

The database connection string is then generated based on our configuration and saved to Web. config. The connection string is also saved in the new ASP. Net file that you just created. This process does not write other code except after the data source is edited. After all OK, just press F5 to run and see the drop-down menu displayed. Good convenience.

After the database is bound, viewing the aspx file in the design displays data binding. Such as:

(c) Compare the differences in the drop-down menu that PHP implements when querying data from a database

1, the implementation of the ASP. NET is a lot more convenient, just need to edit the data source, you can let the data bound in the drop-down menu.

2, PHP Implementation of this, the first is to use mysql_connect () "Connect the database", then the Code database "query statement", finally get an "array", and then through a For loop each item item output in the Foreground drop-down menu. Each step is to achieve their own, unlike ASP., click a little mouse, complete.

[digression: Learning one weeks of the net, the biggest experience is a hand to constantly touch the mouse, because always points ah point, overall OK. ]

Understand the DropDownList edit data source in ASP. NET, bind database data.

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.