Developing asp.net 2.0 database program with VS2005

Source: Internet
Author: User
Tags table name versions management studio sql server express visual studio

First, Introduction

On November 7, 2005, Microsoft officially released. NET 2.0 (including asp.net 2.0), Visual Studio 2005, and SQL Server 2005. All of these components are designed to work together independently. In other words, ASP. NET version 1.x and version 2.0 can be installed on the same machine; you can have both Visual Studio.NET 2002/2003 and Visual Studio 2005, as well as SQL Server 2000 and SQL Server 2005. Also, Microsoft is publishing a Express SKU for Visual Studio 2005 and SQL Server 2005. Note that the Express Edition does not have all the features of the Professional edition.

2.0 in addition to supporting 1.x-style data access, it also includes new data source controls-which make it extremely easy to access and modify database data. When using these data source controls, you simply add the control to the ASP.net page and configure the connection string and SQL query with the properties of those controls. The data source control can then be bound to a data Web control, such as the GridView, by setting the DataSourceID property of the data Web control to the ID of the data source control. Today, it is time to write code to create a connection, create a command, specify a SQL query, retrieve a DataReader or DataSet, and bind it to a data Web control. These steps can be replaced by the use of declarative data source controls. (Of course, you can also access data programmatically by using familiar steps in your 1.x code.) )

In this article we'll look at how to connect and display data from a asp.net 2.0 database. Specifically, we will discuss how to use programmatic and declarative methods to access data, and analyze basic operations that display data through the GridView control.

Ii. manipulating Databases in Visual Studio 2005

When you install any version of Visual Studio 2005, you are always asked if you also want to install the SQL Server Express version. If you choose Yes, this will install the SQL Server Express version in your development package-Note that you are installing Visual Studio 2005! (SQL Server version of Express can be installed with other versions of SQL Server, including SQL Server 2000 and other versions of SQL Server 2005.) )

If you are using SQL Server 2000 in your current project, you can manipulate the database in the most comfortable way through Enterprise Manager. Although you can still use Enterprise Manager to manipulate SQL Server 2000, or use SQL Server 2005 's management Studio to manipulate your SQL Server 2005 database, you can also work with visual Studio 2005 of data connections to manage these databases. I mention this because there is no GUI tool such as SQL Server 2000 's Enterprise Manager or SQL Server 2005 Management Studio for SQL Server version of Express; instead, you have to go through visual St Udio 2005来 Create and manage your SQL Server Express version database.

Prompt to manage SQL Server the Express version database

If you have any other SQL Server 2005 versions other than Express, you can install the client tools on your machine, including the GUI tools that manage the studio-SQL Server 2005 database. If you install this tool, you can also use it to manage the SQL Server Express version database.

To manage a database through visual Studio 2005来, select to Server Explorer, where you will find a data connection node (see the snapshot above). You can add a new database connection by right-clicking on the Data Connection node and choosing Add Connection. This will bring up a dialog box that prompts you for information such as database server, authentication information, what database to use, and so on. If you have a SQL Server Express version installed on your own machine, the database is installed by default by using an instance named SQL Express. Therefore, the service name to connect to is Yourmachinename\sql Express or. \sql Express. In addition to connecting to an existing database, you can create a new database by right-clicking on the Data Connection node and choosing to create a new SQL Server database.

Once a database is added to the Data Connection tab, you can add, delete, or modify data tables, stored procedures, views, and so on through the appropriate folders. To create a new datasheet or stored procedure, right-click the appropriate folder and select the Add New X menu option, and double-click to modify an existing datasheet, stored procedure, or view. This will call them into Visual Studio-where you can modify it as needed. You can also observe and modify the data in a single datasheet-this is done by right-clicking a data table name and choosing "Show data table 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.