Running Visual C# 2008 Express Edition
You can run Visual C# 2008 Express Edition from the Windows Start menu. Once the IDE opens, choose Tools > Connect to Database from the menu. This selection opens the dialog box shown in Figure 8.
Figure 8 Connecting to a data source.
Select the data source, if necessary, and click OK. In the next dialog box (Add Connection), enter the path to the file pubs.mdf. On my system, the default path is as follows:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
Select the file, click Open, and then click OK. The pubs data source should appear, as shown in Figure 9.
Figure 9 Successful access to the database from within Visual C# 2008 Express Edition.
Now you can interact with the pubs database, just as you did with SQL Server Management Studio Express.
Next, we want to access the database by using some C# code.