| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

03-15-07, 08:46
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Dreamweaver to Access Database Connection String
|
|
Hi guys.
I have got myself some free web space at prohosting.com I have managed to upload some files through dreamweaver to the space using the ftp function. My next step is trying to create a connection to my Access Database.
I have created a file called Database on the server, and have placed my database in here. I have then tried to create a connection string to this by trying variuos connection strings, but i keep getting "unidentified error occoured"
I would appreciate any help.
Thanks
|
|

03-15-07, 09:35
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
|
|

03-15-07, 10:34
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
|
|
Hi, i am still a little confuse though. How do i find out the path of my database held on the server? At the moment i right click on it and view the URL. Is this the right way?
|
|

03-15-07, 10:36
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
That sounds good to me...
Remember, if the webpage using the database is in the same folder then you can simply use the filename.
If it's in a subfolder to the webpage then you can use "\sub folder\databasename.mdb"
|
|

03-16-07, 08:58
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Hi. I have tried everything and have still had no luck. Just to let you know, i am using the dreamweaver custom connection string window to try and connect. These are the strings i have used so far
"sDSN="Provider=Microsoft.Jet.IKEDB.4.0;Data
Source=\Database\database.mdb"
"driver={microsoft access driver(*.mdb)}; dbq=/Database/database.mdb"
The ftp testing server works fine, so i know all those setting are correct. My database is called Database.mdb held in a file called Database. Which is a sub directory of where my main site is held.
Really struggling with this.
Thanks
|
|

03-16-07, 09:04
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
I'm afraid my experience of ASP is fairly limited but let's see what we can achieve...
Give this code a bash:
HTML Code:
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open "Database/database.mdb"
....
conn.close
Set conn = Nothing
%>
Let me know how it goes.
|
Last edited by gvee; 03-16-07 at 09:16.
|

03-16-07, 09:11
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Hi, thanks for quick reply. Where do i need to put that code exactly? Up until now i have simply been using dreamwevaer and inputting the connection string into a text box where it prompts me to.
|
|

03-16-07, 09:29
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
I have stumbled across this article which explains how to use dreamweaver to connect to an access database.
As for where to put that code - anywhere you want to use that datasource!
Here's an extended example
Save this code as an asp page (make sure you change the path to your database and table name to your own) and then run it and view the results.
HTML Code:
<html>
<body>
<%
dim conn, rs, x
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "<path to your database>"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM <YourTable>", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
rs.MoveNext
loop
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%>
</body>
</html>
|
|

03-16-07, 09:36
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Nope, still not working. No idea what it is. Think it must be a really simple porblem, just doing my head in! Always errors and says unidentified error.
|
|

03-16-07, 09:38
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
HTML Code:
<% language="VBScript" %>
<% Option Explicit %>
<html>
<body>
....
I think the option explicit will help with the debug.
What did you change <path to your database> and <YourTable> to?
|
|

03-16-07, 09:39
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Wait a minute! Think i just found the problem. My server does not allow the file extension .asp. therefore i am guessing this is why it is erroring! Does anybody know of any good free servers that allow .asp pages and supports a ftp facility?
|
|

03-16-07, 09:53
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Haha, after all that eh? 
Don't suppose you are running windows 200 Pro/Xp Pro/Vista? If so there's something called IIS which comes with it that works as like an emulation server for ASP pages. (useful for practice!).
And to answer your question - no, I'm afraid I do not know of any FREE ones that allow asp pages.
|
|

03-16-07, 13:50
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Right. Next problem encountered.
I have now got my self some new space. Which accepst access databases and asp pages. They even gave me a connection string to use. Which followed the lines of.
"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\TestDB.mdb")
I adapted this to the correct folder and file. However, when i ran the code in dreamweaver, it errord with "HTTP Error Code 400 Bad Request"
I then decided to try and use the exact location of my database. So i made a map path page which returned the following address of my database
e:\xxxxxxx\LocalUser\xxxxxxx\xxxxxxx.somee.com\dat abase\database.mdb
So i am now confident i have the exact location. Can anyone help with why it is erroring when i click "test connection"
|
|

03-16-07, 14:03
|
|
Registered User
|
|
Join Date: Mar 2007
Posts: 9
|
|
Quote:
|
Originally Posted by georgev
I have stumbled across this article which explains how to use dreamweaver to connect to an access database.
As for where to put that code - anywhere you want to use that datasource!
Here's an extended example
Save this code as an asp page (make sure you change the path to your database and table name to your own) and then run it and view the results.
HTML Code:
<html>
<body>
<%
dim conn, rs, x
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "<path to your database>"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM <YourTable>", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
rs.MoveNext
loop
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%>
</body>
</html>
|
Just used that, and it comes up with a list of items in a table in my database. So the connection is fine. Its just dreamweaver errors when i try and use the connection string. Any ideas why??
|
|

03-19-07, 04:13
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Because WYSIWYG editors are poop 
If you know the above connection string is working then just use that - don't try and re-invent the wheel!
and good luck with the project!
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|