Install the sample databases:
Step 1 - Download the sample data bases:
This can be achieved by running the sql scripts (from the download on step1) on SQL Server.
Open the script file on SQL Server (
instnwnd.sql for Northwind or instpubs.sql for Pub):Execute the script to install the database:
After the query completes you might need to hit the refresh button on Object Explorer for the new database to be displayed:
Expand the Databases Node to see the new DB (pubs DB is now installed and displayed on the tree):
Step 3 (Optional) - Create DB diagrams
It migth be a good ideia to create the database Diagram so you can browse the ER and see their relationships. To acomplish this: rigth click the "Database Diagrams" node and select the option "New Database Diagram". (Click yes if prompted).
This will bring a table selection popup. Select all the tables for a full Diagram, or just the ones you wish to inspect.
Press "Add" and the diagram is generated:
Use these databases on Visual Web Developer (VWD)
On "database explorer" panel select "Connect to database".
On the new popup select "Microsoft SQL Server" and hit Continue.
For the next step you need to know the SQL Server Name. The server name is displayed in SQL Server under the "Object Explorer" panel:
In my case the Server Name is "IODA\SQLEXPRESS2008". Being IODA the computer name and SQLEXPRESS2008 the SQL Server instance.
So, on the new popup insert the Server name first. Its vital that you insert the Server Name correctly otherwise the databases wont be displayed for you to select them. Next select the database you wich to connect from the drop down menu. (im selecting pubs database here).
Hit Ok button and your DB is now displayed on VWD DataBase explorer:
To pull information from the database, for example into a GridView ASP.NET Control, read this article/tutorial.
Other articles:
Brian C. Hart has an article where he takes a diferent aproach to install the sample databases (using the mdf files instead of running the sql scripts): HowTo: Install the Northwind and Pubs Sample Databases in SQL Server 2008 Express
No comments:
Post a Comment