|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
What's New in Data
This topic has been updated for Visual Studio 2005 SP1.
Visual Studio 2005 and Visual Studio 2005 SP1 include several new features to assist in developing applications that access data. The following sections describe these new features.
To move around this topic, you can scroll, or jump to a section by clicking one of these links:
What's New in Visual Studio 2005 SP1
Visual Studio 2005 SP1 supports Microsoft SQL Server 2005 Compact Edition as a local data provider. This means you can add SQL Server Compact Edition database files (.sdf) to an application in the same way that you add SQL Server Express (.mdf) and Microsoft Access database files (.mdb). This process is described in the Local Data section that appears later in this document.
SQL Server Compact Edition does not automatically install with Visual Studio 2005 SP1. You must download the runtime from the Microsoft download site. Search for "SQL Server Compact Edition" and download the SQL Server Compact Edition Runtime.
What's New in Visual Studio 2005
The TableAdapter object. The new local data feature allows you to include Microsoft SQL Express and Microsoft Access database files directly in your application.simplifies connecting your application to data. The new Data Sources window provides a central location to view the data available to your project. It also reduces the complexity of data binding by allowing you to drag items from the window onto forms to create data-bound controls. Filling datasets, running queries, and executing stored procedures can now be accomplished by using the new Visual Studio–generated
Data Sources Window Offers Drag-and-Drop Data-Binding
Theis the main window for viewing the data available to your project. You can drag objects from the Data Sources window onto forms to create data-bound controls that display and navigate data. The Data Sources window allows you to set the controls to be created prior to dragging them onto a form. Additionally, items can be dragged from the Data Sources window onto existing controls to automatically configure data binding.
The following pages demonstrate the basic data-binding functionality of the Data Sources window:
Data Source Configuration Wizard for Easily Connecting to Data
The Data Source Configuration Wizard simplifies connecting your application to data in databases, Web services, and objects. You can run this wizard to add or edit a data source in your project. For more information, see.
The following pages describe using the Data Source Configuration Wizard to connect your application to different sources of data:
Binding to Objects
Data sources can be created from any object that exposes one or more public properties. No specific interfaces or default public constructors are required to create a data source from an object. All public properties are displayed in the Data Sources window and can be dragged onto forms to create data-bound controls. For more information, see.
The Dataset Designer has been enhanced to support the new TableAdapter. You can add and editand TableAdapter queries by dragging TableAdapter and Query items from the Dataset tab of the Toolbox onto the designer. You can also drag database objects from Server Explorer/Database Explorer onto the Dataset Designer to create a configured and TableAdapter. For more information, see .
The Dataset Designer is a set of visual tools specifically designed for working with datasets. It provides functionality to visually create and edit TableAdapters, TableAdapter queries, DataTables, and relationships between tables. Wizards assist you in defining and creating TableAdapters and TableAdapter queries to use in your application.
The following pages describe using the Dataset Designer:
Filling datasets, running queries, and executing stored procedures can now be accomplished using the new Visual Studio–generated TableAdapter object. For more information, see.
TableAdapters are designer-generated components; they are analogous to strongly typed data adapters. TableAdapters contain the necessary information to connect to and query a database. For more information, see.
The TableAdapter Configuration Wizard creates and edits a TableAdapter and defines the TableAdapter's associated DataTable. For more information, see.
The TableAdapter Query Configuration Wizard creates and edits the details of a TableAdapter query. A TableAdapter query is any valid SQL query or stored procedure that returns either the same schema as the TableAdapter's data table or a scalar value. For more information, see.
Saving Connection Strings in the Application Settings File
Connection strings can now be stored in a strongly typed application settings file. This eases maintenance of your application by allowing you to make changes to your connection information without having to recompile your application. For more information, see.
The new local data feature allows you to connect to local databases in Microsoft SQL Express and Microsoft Access. When creating the connection to a database file, you are given the option to copy the database into your project, where it can then be deployed as part of your application. For more information, see.
Partial Class Support for Strongly Typed Datasets and TableAdapters
Using partial classes, you can extend the functionality of the generatedand TableAdapter code without having to inherit from the generated classes. Partial classes keep designer-generated code separated from the code you write. For more information on extending a dataset, see . For more information on partial classes, see or .
Windows Forms Applications
Simplified Data-Binding Model
Thesimplifies the process of data binding because it acts as an intermediary between the bound control and the target data source. It automatically manages many of the more difficult binding issues such as currency, data-related events, and changes to data-source targets. It is also designed to interoperate with other data-related Windows Forms controls, particularly the .
Theis designed to simplify the process of binding controls to an underlying data source. The component acts as the data source for some or all of the controls on the form. For more information, see .
Thecontrol is a standardized means to enable simple navigation and manipulation of data on a form. It is used most often with the to move through data records on a form and interact with them. For more information, see .
Thecontrol provides a powerful and flexible way to display data in a tabular format. It can be used to show read-only views of a small amount of data, or it can be scaled to show editable views of very large sets of data. The data can reside in an external data source or be added directly to the control. For more information, see .
Data Smart Tags
Smart tags specific to working with data are available on controls that are typically bound to data. These actions assist you in developing Windows applications that work with data.
Data smart tags expose concise lists of relevant tasks throughout the data access development process. The typical data smart tag appears when data-aware objects are dragged onto forms. For more information, see.
Create SQL Server 2005 Database Objects in Managed Code
The Transact-SQL programming language allows you to create database objects (such as stored procedures) and also query and update data for Microsoft SQL Server 2005 databases. But you can also do all of these things using any .NET Framework language. For more information, see.
Visual Database Tools
The Visual Database Tools have been updated with several new features. The new Add/Modify Connection dialog boxes streamline the creation of database connections. You can choose what type of database you are connecting to, and Visual Database Tools selects the most likely provider as the default. You can still choose an alternative from a list of all applicable providers. Additionally, you can now create connections to Microsoft SQL Express and Microsoft Access database files from within the Visual Studio environment. For more information, see.