Connecting to a Database
Before you can connect to a database you need to create an ASP.NET page. To do this choose File → New. The window, shown in Figure 10, will pop up.
You'll want to choose Dynamic from the category list and then ASP.NET VB from the Dynamic Page list. Choose Create. Dreamweaver then opens a blank page formatted for ASP.NET. The file does not yet have a name, so you'll need to go to Select File → Save to give the file a name. Call it test.aspx. You now have a valid ASP.NET page in your site. The next step is to create a connection to the database.
You will need to open the Database window. Next, select Window → Database. As you haven't set up a database yet, you will see a checklist of things you need to do to have the database connected correctly. This checklist is shown in Figure 11.
Fortunately, you've already done a lot of the hard work and most of the settings have been completed. All you need to do is connect to the database. In the Database window choose the + symbol and select OLE DB Connection. This will open the OLE DB Connection window.
Dreamweaver uses Connection Strings to connect to Access, SQL Server, and Oracle databases. Fortunately, you don't need to remember how a connection string is created because Dreamweaver has templates built for you. In the OLE DB Connection window, choose Templates from the right-hand side and select Microsoft Access 2000 from the list. The following will be inserted into the "Connection String" field:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=[databaseName]; User ID=[username]; Password=[password];
But, you don't need all of this information. To connect to the Northwind database all you need is:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source= C:\Inetpub\wwwroot\Northwind\database\Northwind.mdb;
To test the connection, you must first give the connection a name. You can name the connection "NW_CONN." Once you have done that, select the Test button and you will make a successful connection, as shown in Figure 12.
The database, with expandable tables, views, and store procedures will now appear in the Tables window.
Now you are finally ready to begin developing. This may seem like a lot of work for the setup, but, now that you are here, you will not need to do this for each and every page. Now you can begin building solutions.
- Adobe XD CC Classroom in a Book (2019 Release)
- Book $47.99
- Adobe Dreamweaver CC Classroom in a Book (2019 Release)
- eBook (Watermarked) $38.39