Macromedia dreamweaver 8-using dreamweaver Benutzerhandbuch
630
Chapter 26: Database Connections for ASP Developers
3.
Use the
MapPath
method to obtain a value for the
stringvariable
argument.
Here’s an example:
<% Response.Write(Server.MapPath("/jsmith/index.htm")) %>
4.
Switch to Design view (View > Design) and enable Live Data (View > Live Data) to view
the page.
the page.
The page displays the physical path of the file on the application server. Using the example
discussed in this section, the page displays the following physical path:
discussed in this section, the page displays the following physical path:
c:\Inetpub\wwwroot\accounts\users\jsmith\index.htm
For more information on the
MapPath
method, consult the online documentation that comes
with Microsoft IIS.
Related topics
■
Using a virtual path to connect to a database
To write a DSN-less connection string to a database file located on a remote server, you must
know the physical path to the file. For example, here is a typical DSN-less connection string
for a Microsoft Access database:
know the physical path to the file. For example, here is a typical DSN-less connection string
for a Microsoft Access database:
Driver={Microsoft Access Driver (*.mdb)};
DBQ=c:\Inetpub\wwwroot\accounts\users\jsmith\data\statistics.mdb
DBQ=c:\Inetpub\wwwroot\accounts\users\jsmith\data\statistics.mdb
If you don’t know the physical path of your files on the remote server, you can get the path by
using the
using the
MapPath
method in your connection string.
To create a DSN-less connection with the MapPath method:
1.
Upload the database file to the remote server.
Make a note of its virtual path—for example, /jsmith/data/statistics.mdb.
2.
Open an ASP page in Dreamweaver, then open the Databases panel (Window >
Databases).
Databases).
Dreamweaver displays all the connections defined for the site.
3.
Click the Plus (+) button on the panel and select Custom Connection String from the
pop-up menu.
pop-up menu.
4.
Enter a name for the new connection.
NO
TE
Do not use any spaces or special characters in the name.