Skip to main content
Participant
January 10, 2009
Question

Creating Connection File by hardcoding it?

  • January 10, 2009
  • 2 replies
  • 549 views
When one connects to a database the name for the connection is the "Data Source Name" which is then recorded to a file that appears in the grayed Source Code area. For example, connecting to a database (under database tab) named Herbie creates a file called Herbie.asp (programming in VB Script). This file is then saved to a directory off the root called Connections.

How do we take an existing Connections file and tell dreamweaver to incorporate it into a given page without going through the Database tab process?

Any input would be appreciated. Thanks!

This topic has been closed for replies.

2 replies

WAStrnadAuthor
Participant
January 16, 2009
Thanks again for the feedback. Highly informative!

I've only had Dreamweaver a couple of weeks since cs4 was delivered and I find some of it rather confusing or I should say, different from what I'm used to using. I've crashed Fireworks a couple of times after designing something in it, exporting to html with images and then loading the page in Dreamweaver; it was after I right-clicked to edit page in Fireworks and returned by clicking "Done" in FW that the crash occurred.

Anyway, thanks for the help and suggestions. Much appreciated.

Wayne
Inspiring
January 10, 2009
WAStrnad wrote:
> When one connects to a database the name for the connection is the "Data Source
> Name" which is then recorded to a file that appears in the grayed Source Code
> area. For example, connecting to a database (under database tab) named Herbie
> creates a file called Herbie.asp (programming in VB Script). This file is then
> saved to a directory off the root called Connections.
>
> How do we take an existing Connections file and tell dreamweaver to
> incorporate it into a given page without going through the Database tab process?
>
> Any input would be appreciated. Thanks!

This connection information is added to a page via a server side include. If you add a recordset to a page, at the top of that page will be an include that points to the Herbie.asp file, it'll look something like this:
<!--#include file="Connections/Heribe.asp" -->
Simply adjust the path to the include to be relative to the file you're working with. If your include uses "virtual" instead of "file" for the include, then the path should be root relative.

--
Danilo Celic
| http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert
WAStrnadAuthor
Participant
January 11, 2009
Danilo,

Thanks for the reply.

For other readers that might have a similar problem, here is a link to the docs that tells one how to set things up: http://livedocs.adobe.com/dreamweaver/8/using/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=28_con11.htm

I think I need to be a little more specific so as to define the environment I'm working with. It's Vista with IIS7 installed. I can and did setup the connection as you mentioned in the reply. Sure does work. However, when I tried to upload those files it was one error right after another. I eventually discovered, by trial and error, what the solution was.

The problem was determining the connection string, not on the local system, but the hosting company - GoDaddy. To do that, one needs to figure out where ones account directory is to write the path info to the database. I modified the herbie.asp connection string that dreamweaver created to the following:

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
' The lines above were created by dreamweaver
dim oConn
dim db_path
db_path = "d:/hosting/myaccountdirectory/access_db/TheDatabaseToConnectTo.mdb"
Dim MM_Herbie_STRING
MM_Herbie_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db_path
Set oConn = Server.CreateObject("ADODB.Connection")
%>

Now perhaps to the casual observer the first question might be, where and how did he come up with db_path string? Is it the old "Watch me pull a rabbit out of my hat" thing? Well, if you need to do this part yourself, copy that info and comment out the "d:/hosting..." line and then upload the file and test it. You won't see your page but you'll see the error that's generated. That error tells you the path that the hosting company is looking for. Then change that info in your own file to that of the reported error.

Now after all that work, which took more hours than I care to think about a problem in one sitting, I wanted to have that file info available to other pages I need to design.

One simply cannot type the connection string shown above in the creation process for connecting a recordset. Dreamweaver barks at you for even trying.

Adding the #include file manually in source? Love to. I created a blank page for VBScript and then saved the html as an asp page. Here is the source code that anyone can generate:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Where in this source would I include the herbie.asp file. Would it appear under the tab with source code (in design view)?

Here is a code snip that does work and was setup by using local connections so that dreamweaver could set up herbie.asp.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/Connections/Herbie.asp" -->
<%
Dim rsRefOnFile
Dim rsRefOnFile_cmd
Dim rsRefOnFile_numRows

Set rsRefOnFile_cmd = Server.CreateObject ("ADODB.Command")
rsRefOnFile_cmd.ActiveConnection = MM_Herbie_STRING

But the problem is, how do I attach say herbie.asp to a blank page so that dreamweaver knows about the included file? Is there a way to make dreamweaver understand the connection string that I need: MM_Herbie_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db_path?

Right now I have to develop local recordset connections and let dreamweaver create the herbie.asp. I then have to redo the contents of herbie.asp and upload the file. Lots of work for a few pages and if I need to edit something down the road, the odds that I remember this might be slim to none.

I hope I was not to detailed in this but gave enough info for others who might come across the same situation.

Thanks again for the input. Any further suggestions?

Wayne