What is Database Preparations?
We
will be using Microsoft SQL Server 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. Alternatively, if you still don’t have it, you can download it
from the link below:
After
installing the SQL Server 2008 Express, you must download a sample database
named the Northwind databases. This is the sample database to be used on the
upcoming lessons so you must download it.
After
you have downloaded the SQL Server installation file, install it. After the
installation, the scripts needed to create the Northwind database will be
located at C:\SQL Server 2000 Sample Databases. To execute the script, first,
open SQL Server Management Studio. You will be presented with a window that asks
for the server name and the authentication information. For now, just use the
details shown in the figure below. Click Connect.
We
need to open the script first so go to File > Open > File, then browse
to C:\SQL Server 2000 Sample Databases. Choose the file
named instnwnd.sql and open it.
The script contains the SQL commands needed to create the Northwind database.
Now click the Execute button located on the toolbar (the red exclamation). The Northwind database is now successfully created. You can now close the SQL
Management Studio.
If
that process is too long, there’s an alternative way to installing the Northwind
script. Open the command prompt and type the following command:
sqlcmd -S .\sqlexpress -i instnwnd.sql
To test if the database is successfully installed type the following command in the command prompt.
sqlcmd
use northwind
select firstname from employees
go
If nothing is wrong, you should be presented with a list of names
Read More
- Databases and ADO.NET
- How does Ado Net work
- What is Database? What is SQL?
- What is connection string C#?
- SQL vs NoSQL or MySQL vs MongoDB
Share this article with your friends
Post A Comment:
0 comments: