Microsoft 9GD00001 ユーザーズマニュアル

ページ / 449
 
182
 
Microsoft Visual Studio 2010: A Beginner’s Guide
Key Skills & Concepts
 
Work on SQL Server Databases with Visual Studio 2010
 
Query Data with Language Integrated Query (LINQ)
 
Use LINQ to SQL to Query and Manipulate SQL Server Data
M
ost of the work we do each day involves data, and most of the data we work with 
comes from databases. Because of the importance of data in our applications, this 
chapter introduces how to work with data in VS. It’s very important to learn the concepts 
in this chapter because it will affect all of the work you do when programming. You’ll also 
see many examples of working with data throughout the rest of this book, underscoring 
the importance of data in software engineering.
While you’re free to work with any data source you want, Microsoft has several 
versions of SQL Server from free Express versions to Enterprise level. Since SQL Server 
Express ships with VS, we’ll use that for all of the examples in this chapter and the rest 
of the book. Don’t worry; the development experience for Express is similar to all other 
versions, so what you learn will be applicable to other versions of SQL Server.
Data operations are so important that you also have support in the programming 
languages for working with data called Language Integrated Query (LINQ). You can use 
LINQ to query many types of data sources, whether it is objects, XML, or relational data. 
This chapter will show you how to use LINQ for querying data from SQL Server.
Working with Databases
VS provides several tools for working directly with databases. The free Express versions 
of VS, such as Visual C# Express and Visual Basic Express, don’t have this built-in 
support. However, you can visit MSDN and download the free SQL Server Express for 
database work alongside the Express versions. What I’ll show you in this chapter will be 
available in VS Professional or later, which includes support for working with SQL Server 
directly in the VS IDE.
Introduction to Server Explorer
You don’t need to open a project to perform any database work. To start working with 
databases in VS, you need to start VS and then open Server Explorer by clicking