Setup Instructions

Updated 11/11/2004

The following instructions are designed to work on your home computer. If you’re using a network in your college’s computer lab, ask your classroom instructor or network adminstrator for specific instructions on running the book’s sample programs. Click here if you are a network adminstrator for a college computer lab.

Step 1: Run the Setup.exe program

  1. Insert the CD-ROM supplied with this book and run the Setup.exe program. All files will be installed in the c:\vbdata directory.
  2. Use Windows Explorer to browse the c:\vbdata directory, and verify that the following folders exist:
           \ch01, \ch02, \ch03, \ch04, \ch05, \ch06, \ch07-10, \ch11
You should not have to run Setup.exe a second time. But if, for some reason you want to do so, stop SQL Server. (Use the SQL Server Service Manager icon on your computer's Task Bar to start and stop SQL Server.) Restart SQL Server after Setup.exe has finished.

Step 2: Install the Database Server

Step 3: Attach the Databases

Step 4: Install Internet Information Services (IIS)

You must install Internet Information Services (IIS), supplied with the following operating systems: Windows 2000 Professional, Windows 2000 Server, Windows XP Professional, Windows XP Server, and Windows 2003 Server. Click here for detailed instructions.

Step 5: Create IIS Application Directories

Click here to see how to create the IIS application directories you need when running the ASP.NET applications from chapters 7, 8, 9, and 10.

 

You're All done!


 

 

 

 

 

 

 

 


Attach the Databases (SQL Server 2000)

In this step you will attach several SQL server files to your SQL Server 2000 server. Every computer using Microsoft Windows has a machine name. SQL Servers are usually named after their local computer's machine name, and you can use the name (local) as a default local server name. The following instructions will assume your server uses (local).

Double-click on the file named attach.bat, located in the c:\vbdata directory (the default install directory for the book's CDROM). If you have installed the CDROM somewhere else, look for attach.bat there.

You should see a series of messages indicating that four databases have been attached to your server (Campus, KayakStore, SportsRental, and Pubs). Ignore the warning message saying that Pubs is already attached.

Different Server Name?

If you see error messages indicating the databases were not attached correctly, your server name may be different from your computer's machine name. Look for the SQL Server Service Manager icon on the right side of your computer's Task Bar (at the bottom). Open it, and look for the name next to Server. That will be your server's name.

Open a Command window (select Run from the Start menu, enter cmd, click OK). Type the following command (where servername) is your SQL server's name:

    attach servername

Hopefully, your server will be found, and the four databases will be attached. To verify success, open Enterprise Manager (a utility that is part of SQL Server 2000) and look for the new database names.

Note: The attach.bat file will not let you attach the sample databases to the same server twice. If you must detach the databases, use SQL Server 2000's Enterprise Manager tool.

Can't find the data files?

If your database files were not found, you might not have installed the CDROM in the c:\vbdata directory. If your files are somewhere else, you'll have to edit the file named attach.txt, and change the paths of the data files listed there. For example, here is the information for the KayakStore database, which assumes it is located in the c:\vbdata directory:

    EXEC sp_attach_db @dbname = N'KayakStore', 
    @filename1 = N'c:\vbdata\KayakStore_Data.mdf', 
    @filename2 = N'c:\vbdata\KayakStore_Log.ldf'
    GO

Suppose you installed the CDROM in the c:\advancedVB directory. Then the corresponding entry in attach.txt would be:

    EXEC sp_attach_db @dbname = N'KayakStore', 
    @filename1 = N'c:\advancedVB\KayakStore_Data.mdf', 
    @filename2 = N'c:\advancedVB\KayakStore_Log.ldf'
    GO

Maybe installing the CDROM in its default location wasn't such a bad idea, after all. ;-)


 

 

 

 

 

 

 

 

 

 

 


Attach Databases (MSDE)

Open a Command window: Select Run from the Start menu, and run the cmd.exe program. When the Command window appears, execute the following commands:

   c:
   chdir \vbdata
   attach (local)\NETSDK

Open Visual Studio .NET and open the Server Explorer window. Expand Servers, expand SQL Servers, and expand the entry under <machine>\NETSDK, where <machine> is your computer name. You should now see four new databases: Campus, KayakStore, Pubs, and SportsRental.

Different Server Name?

If you see error messages indicating the databases were not attached correctly, your server name may be different from your computer's machine name. Look for the SQL Server Service Manager icon on the right side of your computer's Task Bar (at the bottom). Open it, and look for the name next to Server. That will be your server's name.

Open a Command window (select Run from the Start menu, enter cmd, click OK). Type the following command (where servername) is your SQL server's name:

    attach servername

Hopefully, your server will be found, and the four databases will be attached. To verify success, open Server Explorer in Visual Studio .NET and look for the new database names.

Can't find the data files?

If your database files were not found, you might not have installed the CDROM in the c:\vbdata directory. If your files are somewhere else, you'll have to edit the file named attach.txt, and change the paths of the data files listed there. For example, here is the information for the KayakStore database, which assumes it is located in the c:\vbdata directory:

    EXEC sp_attach_db @dbname = N'KayakStore', 
    @filename1 = N'c:\vbdata\KayakStore_Data.mdf', 
    @filename2 = N'c:\vbdata\KayakStore_Log.ldf'
    GO

Suppose you installed the CDROM in the c:\advancedVB directory. Then the corresponding entry in attach.txt would be:

    EXEC sp_attach_db @dbname = N'KayakStore', 
    @filename1 = N'c:\advancedVB\KayakStore_Data.mdf', 
    @filename2 = N'c:\advancedVB\KayakStore_Log.ldf'
    GO

Maybe installing the CDROM in its default location wasn't such a bad idea, after all. ;-)

Detaching a Database

Visual Studio Server Explorer doesn't havea command to detach databases. Instead, you must run the OSQL utility. Close Visual Studio .NET, and open a Command window. Execute the following to detach the database named <name>:

   osql -E -S (local)\NETSDK
   exec sp_detach_db @dbname = '<name>'
   go

For example, the following EXEC command detaches the Campus database:

   exec sp_detach_db @dbname = 'Campus'

Open Server Explorer in Visual Studio .NET again to verify that the database has been removed. Detaching a database does not delete the files holding the data. You can reattach the database files at a later time if you wish.

Running Two Servers on the Same Computer

In the unlikely case that you have installed both SQL Server 2000 and MSDE on the same comaputer (as the authors have), you must temporarily stop the SQL SERVER 2000 instance before trying to attach any shared database files to your NETSDK server.


 

 

 

 

 

 

 

 

 

 

 


Install SQL Server 2000

If you have SQL Server 2000 and have not installed it already, run its setup program. During setup, you will be asked for the authentication mode, user name, and password. Here are the default values we use in the book:

  • authentication mode: SQL
  • user name: sa
  • password: (blank)

If your computer runs on a network, your system administrator will probably require different values for the user name and password.


 

 

 

 

 

 

 

 

 

 

 

 


Install Microsoft SQL Server Desktop Engine (MSDE)

If you do not have SQL Server 2000, you can use the Micrsoft SQL Server Desktop Engine (MSDE) instead. Open the \Setup\MSDE folder in your installed Visual Studio .NET directory. For example, the full pay may be c:\Program Files\Microsoft Visual Studio .NET 2003\Setup\MSDE. Double-click on either setup.exe or msde_readme.htm. The latter will guide you to a directory on the Microsoft Web site where you can download MSDE (currently about 70 MB).

Instructions for Version: Service Pack 3a

MSDE stands for Microsoft SQL Desktop Engine. It's a free substitute for SQL Server that works well with Visual Studio .NET. Currently, the download link is: http://go.microsoft.com/fwlink/?linkid=13962

(This link may change.) After downloading MSDE from the Microsoft Web site, dDouble-click its .exe file to extract all files required to install MSDE on your computer. (Currently, the file is named sql2ksp3.exe.)

After extracting the MSDE installation files, open a Command window: Select Run from the Start menu, and run the cmd.exe program. When the Command window appears, execute the following commands, pressing Enter at the end of each line:

   c:
   chdir \sql2ksp3\MSDE

To install a default instance configured to use Windows Authentication Mode, execute:

   setup INSTANCENAME="NETSDK" SAPWD="mypassword"

Substitute your own password for "mypassword". For example:

   setup INSTANCENAME="NETSDK" SAPWD="xxy123"
  • Reboot your computer and open Visual Studio .NET.
  • Open the Server Explorer window, expand Servers, and then expand SQL Servers.
  • Expand <machine>\NETSDK, where <machine> is your computer name. You should see four databases listed under the NETSDK server: master, model, msdb, and tempdb.

 

 

 

 

 

 

 

 

 

 


Installing Internet Information Services

Use the following steps in Windows XP Professional to install Internet Information Services:

  1. From the Start Menu, select Settings
  2. Select Control Panel, select Add or Remove Programs, select Add/Remove Windows Components, select Internet Information Services, select Details, and select FrontPage 2000 Server Extensions.
  3. Click on OK twice, closing the Windows Components Wizard.

(Similar commands can be used for the other versions of Windows listed above.)

Once IIS is installed, copy the contents of the c:\vbdata\ch07-10 folder into the C:\Inetpub\wwwroot folder.


 

 

 

 

 

 

 

 

 

 

 

 


Create IIS Application Directories

Assuming you will be loading and running the programs from chapters 7 through 10 in Visual Studio .NET, you must identify each ASP.NET application folder as an Web application. This is done using the Internet Information Services Admistrator program. The following instructions show how to run the program and modify a Web folder.

Step 1. On the Start menu, right-click My Computer, and select Manage.

Step 2. In the Computer Management window, expand Services and Applications, expand Internet Information Services, expand Web Sites, and expand Default Web Site:

Step 3. Perform the following steps for each of the folders copied from the CD-ROM's Ch07-10 directory:

(a) Right-click on the folder and click Properties (our sample shows the folder named Cool):

(b) In the Properties dialog box, select the Directory tab:

(c) Click on Create in the Application Settings section. Notice that the Application name is the same as the folder name:

(d) Click OK.

Now do the same for each example program's directory in the \Inetpub\wwwroot directory.

(done)

After creating the IIS application folders, you can run each of the applications by clicking on the following hyperlinks:

Chapter 7: Cool, Grid_vs_Flow_Layout, KayakTour, LayoutGuides, Login, Picnic, PicnicConfirm, RequestDemo, SampleControls

Chapter 8: ComputerClubTasks, CookieExample, CustomErrors, FileUploadDemo, KayakTourScheduler, MailDemo, Pizzicato Music, SessionDemo, Validation_1, ViewState

Chapter 9: Authors, DataGridExample, DataList, DataReader, GridButtons, JobsEmployeeGrid, KayakGrid, RadioButtonKayakTypes, RentalReserve, Repeater

Chapter 10: BookInfo, BookInfoDb, BookInfoDb2, ConsumeBookInfo, ConsumeBookInfoDb2, UserList, UserListConsume


 

 

 

 

 

 

 


Instructions for Network Adminstrators

MS-Access Databases

Each student needs read/write access to the following MS-Access databases: company.mdb, concert.mdb, SalesStaff.mdb, and karate.mdb.

The default folder used by the sample programs is c:\vbdata. If you prefer to use a network share, Chapter 3 in our book tells students how to select a different folder by modifying the database connection string. If students are not given access to SQL Server, the following MS-Access databases will be required: company.mdb, concert.mdb, SalesStaff.mdb, karate.mdb, pubs.mdb, campus.mdb, KayakStore.mdb, and SportsRental.mdb.

SQL Server Databases

The following sample databases are located in the \vbdata directory of the CD-ROM, and must be attached to your SQL Server: campus, KayakStore, and SportsRental.

We recommend that each lab worstation has its own SQL Server instance. In addition, students will use the pubs database, supplied with SQL Server. They will be udpating database rows, creating, and deleting stored procedures. The sample programs in the book assume the database username is sa and the password is blank. Let students know which username and password to use, and remind them to substitute these values in their programs' database connection strings.

Sample Programs

There are two types of sample programs on the CDROM:

  • Windows desktop applications, in the ch01, ch02, ch03, ch04, ch05, ch06, ch11, and ch12 folders. Each student will need their own copy of these files, located in a directory having read/write permissions.
  • ASP.NET applications, in the CD-ROM folder named ch07-10. These programs must be copied to a Web site accessible by students with read/write permissions. You will need to run IIS Administrator and designate each sample program's folder as a Web application. Here are the steps for each folder:

    1. Right-click the project folder and select Properties.
    2. Select on the Directory tab and click on Create in the Application Settings section.
    3. Click OK to close the Properties window.

Creating New ASP.NET Applications

In the computer lab at Miami-Dade College, a local Web server runs on each workstation. Most labs use ghosting software to copy the disk image to all workstations, and IIS can be included in the image. The major reason for running a local copy of IIS is that students can run their programs in Debug mode and step through program code one line at a time. Grading student projects will be slightly more difficult for professors, since they probably will not be able to access localhost on each student's workstation.

A less desirable solution (used at Florida Internation University) is to run a shared Web server on the network and create a virtual Web directory for each student (using their student ID as a folder name, for example). Students will not be able to Debug their programs, but they will be able to run them. On the bright side, professors can grade student projects by accessing the student's virtual folder on the shared server.

If have further questions, send us an email message. Please identify your college and VB instructor name.

Return to Top