Steps in linking VB.Net to databases

(Be careful and use the correct version of instructions below)

Chapter and page references are for Learning Programming Using Visual Basic.Net by Burrows & Langford, McGraw-Hill

[VB.Net 2003]  [VB.Net 2002]

 


VB.Net 2003

 

Note: Rebooting helped me recover from some errors, so I’d recommend rebooting between major headings below.

 

Install IIS

  1. Go to control Panel (start, control panel)
  2. switch to classic view
  3. double-click add/remove programs
  4. click add/remove windows components
  5. click IIS (Internet Information Server)

 

Install MSDE and sample databases

  1. Navigate to the site:

http://go.microsoft.com/fwlink/?linkid=13962

  1. Click on the DOWNLOAD link in the window on the right. It is a 70 megabyte download, but it downloads faster than I expected in the office. Click OPEN to begin the installation. You can click FINISH to accept the default location or change the location if you need to manage your space.
  2. Navigate to the folder: C:\sql2ksp3\MSDE and double-click the SETUP.INI file. Place the cursor under the [Options] and create a new line if necessary.  Type the following line:

SAPWD=xxxxxxx     (and insert your password instead of the xxxxxxx).

  1. Close and save the SETUP.INI file.  Get back to the folder c:\sql2ksp3\MSDE and double-click SETUP.EXE. Don’t believe the time remaining numbers. It will take longer than it says.  Don’t worry.

 

Install the samples

  1. Navigate to the folder:

C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Setup

  1. Find ConfigSamples.exe and double-click it.
  2. Don’t bother clicking Launch.

 

Make sure SQL Server is running

  1. Make sure SQL Server is on the status Bar—to the right.  The icon looks like a file cabinet with a green “play” button.  Double-click it. If you can’t find the icon, perhaps you didn’t reboot.
  2. You’ll get the window shown on page 546 that provides the server name. Also, make sure the “auto start” option is checked.  Then close it.

 

Make sure the PUBS sample is loaded

Note: In steps 2 and 3, you can copy and paste into the character-based window!  Just right click and you can paste.  Control-V doesn’t work.

 

  1. Open a character-based window for issuing VS Net commands:

Start menu --> Programs --> Visual Studio 2003 --> Tools --> VS Net 2003 Command Prompt

 

  1. Navigate to the right place by typing exactly as follows:

cd "\Progra~1\Microsoft Visual Studio .Net 2003\SDK\V1.1\Samples\Setup"

 

  1. type the following to start up the pubs database (note: Pay attention to case!  Make sure “E” is capitalized and “i” is not)

osql -E -i instpubs.sql

 

After you do this, you will see lines and lines of 1> 2> 3> etc. with messages.  Just sit back and enjoy the show!

Back to VB

  1. On your project, pull in Toolbox – Data and find OleDbDataAdapter.  Double click and the Wizard starts
  2. Next
  3. New connection
  4. Click down button. After an eternity or two (over 90 seconds), the screen will finally flicker and the server name should appear in the drop-down list, matching that in the SQL Server pop up.
  5. Make sure options are selected as in Figure 8.10 on pg. 339. (it’s easy to miss some of this, so be careful):
    1. Use NT integrated security
    2. Select the database on the server and choose PUBS
  6. DONE!  Continue with text from 339 on.

VB.Net 2002

 

Note: Rebooting helped me recover from some errors, so I’d recommend rebooting between major headings below.

 

Install IIS

  1. Go to control Panel (start, control panel)
  2. switch to classic view
  3. double-click add/remove programs
  4. click add/remove windows components
  5. click IIS (Internet Information Server)

 

Install MSDE and sample databases

  1. Navigate to the folder:

c:\Program Files\Microsoft Visual Studio.NET\FrameworkSDK\Samples\Setup\msde

  1. Find instmsde.exe and double-click it.

 

Install the samples

  1. Navigate to the folder:

C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Setup

  1. Find ConfigSamples.exe and double-click it.
  2. Don’t bother clicking Launch.

 

If you have trouble, you might try the following:

C:\Program Files\Microsoft Visual Studio.NET\ FrameworkSDK\Samples\Setup\html\ConfigDetails.htm

and follow the instructions on running IIS.

 

Make sure SQL Server is running

  1. Make sure SQL Server is on the status Bar—to the right.  The icon looks like a file cabinet with a green “play” button.  Double-click it.
  2. You’ll get the window shown on page 546 that provides the server name. Also, make sure the “auto start” option is checked.  Then close it.

 

Back to VB

  1. On your project, pull in Toolbox – Data and find OleDbDataAdapter.  Double click and the Wizard starts
  2. Next
  3. New connection
  4. Click down button. Server name should appear, matching that in the SQL Server pop up.
  5. Make sure options are selected as in Figure 8.10 on pg. 339. (it’s easy to miss some of this, so be careful).
  6. DONE!  Continue with text from 339 on.