This tutorial will demonstrate the process of setting up a database connection in Macromedia Dreamweaver MX 2004. The database that I will be using for this tutorial is an Access Database. I will use the DSN-Less approach to connect to the database since not all ISPs favour the DSN approach for setting up database connections.
SETUP DATABASE:
So before we dig in, lets setup our Access Database. I will create a database in C:\test\test.mdb. Here is how my database looks like:
Notice that the "srno" field is assigned the primary key. The name of this table is "Table 1". Lets go ahead and add some data to this database.
Now let's save the database and set Read permissions for the IUSR_xxx account. These permissions have to be set be
START DREAMWEAVER:
Let's open up Dreamweaver and go to File > New > Dynamic Page > ASP VBScript > Create. Once the file is created, save it under your webroot location. I have saved the file as "dmx_db.asp". Now the fun begins...
Open the Databases panel (Window > Databases)
Click the Plus (+) button on the panel and select Custom Connection String from the pop-up menu.
The Custom Connection String dialog box appears.
Complete the dialog box as follows:
In the Connection name, type conn. This will be the name of your database connection (it could be anything you want)
Now click on the Test button to make sure that everything is going fine.
If you see the above window, it means everything is going fine. However if you don't see the above window, you need to restart and follow the explained process.
Now under the database tab you should be able to see the "conn" connection that you just created. Expand the tabs and you should be able to see the table and the column names that were previously created in the database.
CONNECT DATABASE WITH A DYNAMIC DROP-DOWN LIST:
Now that we have the database in place, we can now connect any of the HTML input fields to the database. To start this process, the first thing that we have to do is to create a Recordset. The Recordset will hold the values returned from a SQL Query and then the resulting fields can be used to populate a drop-down list.
The Recordset will be defined in the Bindings Window (Window > Bindings). Click the + sign and choose Recordset (Query). A new window will pop-up. Fill in the details as shown below and click on OK:
Once completed, you will see a Recordset entry in the Bindings window. Now it's time to create an input field and assign this recordset to our HTML field.
Create a Form Region and then create a List/Menu .
Click on the List/Menu to select it and then click on "Dynamic..."
Fill in the details as shown below and save your work:
TRY IT OUT
Now open up your browser, and type in the URL to the page you just created. When the page comes up, the drop-down list will be populated with the names stored in the database.
Thats all... and remeber, the possibilities are endless. You can customize your query and filter records based on your need.
by Paul on Thursday, October 20th 2005 at 01:05 PM
Thank-you for your time and effort... this has been one of the easiest and most straight forward tutorial I have seen. Unfortunately I am supposed to make a dynamic data web-based page for some friends at GeoCities... their server will not allow asp extensions... could you recommend another solution? Thanks in advance. Paul.
by Nabeel Akhtar on Thursday, October 20th 2005 at 05:47 PM
Paul,
You would have to use some type of server end language in order to make a dynamic page. I don't know what type of service does GeoCities offer but you can ask them if they support some other languages such as PHP.
--------------------------------------------------------
Nabeel Akhtar
http://www.nabeelakhtar.net
by Katie on Sunday, February 26th 2006 at 09:03 PM
THANKS SO MUCH!!!
by Chris Ransom on Thursday, May 11th 2006 at 12:02 PM
Excellent tutorial and very easy to follow. Works perfectly in Dreamweaver but when I try to run the ASP code on my IIS Server I am getting an error:-
General error Unable to open registry key \\\'Temporary (volatile) Jet DSN for process 0x10b8 Thread 0x310 DBC 0x1688fec Jet\\\'
Do you have any idea why this might be?
by Stuart Clark on Thursday, July 6th 2006 at 05:08 AM
Excellent tutorial, the best and easiest I've found. Keep up the good work!
by hamdan on Tuesday, March 11th 2008 at 08:11 AM
i made da connection successfully but when i go to binding there is no sign of + appear i mean when i click Click the + sign no new window will pop-up.please help me
by alice on Tuesday, March 18th 2008 at 01:55 AM
how do u set up the test server?
by maggi on Saturday, April 12th 2008 at 08:18 AM
this was very useful. thnx
by Makuo on Wednesday, May 7th 2008 at 06:47 AM
This tutorial is excellent. I am excited it worked.
But when u make selection from the list, it opens an error page, how do I stop that.
by makuo on Wednesday, May 7th 2008 at 06:53 AM
After setting up the connection, How do I setup my connection to enter records and save/update my database.
I created an .asp webpage using dreamweaver and MS Access DB.
by edwin on Tuesday, June 3rd 2008 at 08:23 PM
But how can I get it to work with MySQL?
by satyendra jain on Thursday, June 26th 2008 at 06:55 AM
I created an .ASP using XML online news update to server side
by edwin on Thursday, June 26th 2008 at 11:12 AM
good for you... but isn't that a tiny little bit off topic?
It seems like the site you manage within Dreamweaver needs to be set up as a PHP-MySQL site, and won't work with ASP due to the PHP integration of Dreamweaver.
By the way, I am talking about the database binding controls, you can select on in the database menu.
But please, tell me if I am wrong here, that I can actually use an ASP site to deal with MySQL (besides programming the whole thing in the script editor). I could realy use something like this. I don't want to get involved in learning PHP since I don't have to the time to learn another language or dialect. :-)
by Bhavya on Friday, July 4th 2008 at 02:24 AM
i am getting this error
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/test/dmx_db.asp, line 5
by Bhavya on Friday, July 4th 2008 at 02:24 AM
i am getting this error
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/test/dmx_db.asp, line 5
by aryadi on Friday, March 13th 2009 at 10:09 AM
thank's for u're meaning info,,,,for me 'n other,,,go on
by vasudha bhat on Saturday, February 27th 2010 at 12:20 PM
Yr tutorial is excellent. I could do everything in my Dreamweaver on localhost. I have created a DSN on my real website, using same .mdb file. Kindly guide how I use this .mdb file on my real website.
by vasudha bhat on Saturday, February 27th 2010 at 12:20 PM
Yr tutorial is excellent. I could do everything in my Dreamweaver on localhost. I have created a DSN on my real website, using same .mdb file. Kindly guide how I use this .mdb file on my real website.