184Microsoft Visual Studio 2010: A Beginner’s Guide

Figure 7-2 Create New SQL Server Database

To create a database, right-click Data Connections in Server Explorer, and select Create New SQL Server Database. This will show the Create New SQL Server Database window, shown in Figure 7-2.

In Figure 7-2, the server name is .\sqlexpress. The dot before the backslash represents the current machine name, and the sqlexpress is the name for the SQL Server Express database. Server names will vary, depending on the location of the server and the name given to the database server instance. For example, if you were deploying an application to a shared Web hosting site, the server name would look something like sql02.somedomain. com, which is established by the hosting provider you are using.

Your authentication options include Windows and SQL Server. Here, I’m choosing Windows authentication because it’s the simplest option. The database created here is local, but you might have a database already created on a server at another location.

The database on another server might have a SQL login, which is another method of authentication.

After adding the database name, click OK to create the database. As shown in Figure 7-2, we’ve called this database MyShop, representing an application that supports customers who order products from a store. You’ll see the new database under Data Connections in Server Explorer, similar to what you see in Figure 7-1. Now you’re ready to add tables.

Page 207
Image 207
Microsoft 9GD00001 manual Create New SQL Server Database