Querying a Database: Disconnected Approach
We can query results from a database while not keeping associate degree open connection.This is…
We will be using Microsoft SQL Server 2008 Express as our main data source. SQL Server is already installed if you have Visual C# Express or Visual Studio 2010, provided that you didn’t uncheck the option of installing SQL Server during installation. We will also be using the SQL Management Studio Express which is a program that contains graphical tools for creating databases. Even if SQL is already installed via the installation of Visual C# Express, the SQL Management Studio might still not be installed. To check if it is already installed, go to Start > All Programs > Microsoft SQL Server 2008 and check if SQL Management Studio is there. If not, then you have to download and install it first. Don’t worry though if you don’t have SQL Management Studio as I will present two ways on creating and manipulating databases; using SQL Management Studio and using the simple command prompt. If you don’t have SQL Server 2008 and SQL Management Studio, then you can download and install it manually. The following shows you step by step guide on how to do download and install them to your computer.
The first step is to download an all-in-one package containing Microsoft SQL Server 2008 and Microsoft SQL Server Management Studio using the following link.
When you arrive at the download page, click the SQL Server 2008 R2 Express tab.
You will now choose which system you are currently using as described earlier. Choose the type of system you have (32-bit or 64-bit).
You will be taken to another page. Choose your language desired using the drop-down list and then click the download button.
Once you have downloaded the installer, execute it to begin the installation. The following shows step by step instructions on how to install Microsoft SQL Server 2008 R2 Express Edition and the SQL Server Management Studio.
The installer will begin extracting required files for the installation. Wait for it to finish.
The SQL Server Installation Center will show up. Be sure the “Installation” is selected. Since we will be installation SQL Server, choose the first option.
Wait for the installation to start up.
In this window, read the License Terms and check the first checkbox to accept it. Click Next to proceed to the next step.
Wait again for the installer to load the required installation files.
The setup will check your system for required components. If it sees a missing component, then you need to download and install them first. Click Next if no errors were detected.
This window allows you to select different features and the installation path for your SQL Server Express. Leave everything as is and click Next.
This window asks for the name of the database instance that will be used by SQL Server Express. You can name it anything you want, but it is recommended to leave it to its default name of SQLEXPRESS.
The following window might be automatically skipped during installation. It shows the disk space requirements needed by the program. Click Next.
This window specifies the accounts that will have access to the database. Change the account name of the first row to
NT AUTHORITY\SYSTEM and the second row to NT AUTHORITY\LOCAL and be sure that both has their Startup Type as Automatic.Click Next.
This window allows you to choose an authentication type. Choose Mixed Mode to allow both Windows Authentication and database authentication. You will also need to provide a password for the sa (System Administrator Account) which will have full credentials and control with the databases. Please make sure that you remember that password that you will type. You can also add more users to your database, but for this tutorial, we won’t be needing that. Click Next.
This window gives you an option to send error reports to Microsoft so they can fix it. It is up to you to check the option or you can simply ignore this and click Next.
The setup will now begin installing Microsoft SQL Server 2008 R2 Express. Wait for the installation progress to finish. Then click Next.
Congratulations, you have now successfully installed Microsoft SQL Server 2008 R2 Express. Click Close. Close the SQL Server Installation Center if it is still open.