Skip to main content
Inspiring
April 29, 2007
Question

File DSN

  • April 29, 2007
  • 1 reply
  • 308 views
Hi. Not sure how this is going to sound.
Dreamweaver creates a connection string when setting up a communication between a Database and an ASP page. IAn include file. No issues with this until I have fallen upon Godaddy. They use File DSN not system DSN. They present a sample and I have tried to follow it. I can get part connection but all the time with errors.

The connection string they suggest is:

<%
Dim oConn, oRs
Dim qry, connectstr, sDSNDir
Dim db_name, db_username, db_userpassword
Dim db_server, dsn_name

dsn_name = "your_dsn_name"
fieldname = "your_fieldname"
tablename = "your_tablename"

sDSNDir = Server.MapPath("_dsn")

connectstr = "filedsn=" & sDSNDir & "/" & dsn_name

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & " "
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%

So...I alter the dsn name to be my dsn, the field name to be the first field in the table and the table name to be the table being referenced in the Database. Am I wromg in assuming that this string is a replacement for the include file that is created automatically when an ASP page is created ie <!--#include file="Connections/gwlconn.asp" -->

I am not getting the point with File DSN and cannot see what I am doing wrong. It seems odd to reference one field on the table as a variable. Just does not make sense. I have traweled the web and keep coming up with dead ends. I can see other people have had issues with this also. Can someone do an idiots guide to setting up a File DSN please.

A blow by blow.

Note: I have a File DSN on Godaddy according to the system when I access the account. It must exist as I can get albeit data returned by in a bad order and with errors associated.

Thanks to anyone wishing to help out.

Paul
This topic has been closed for replies.

1 reply

Inspiring
April 30, 2007
Here is a good source for setting up ADO connections to access database file.
http://www.w3schools.com/ado/ado_connect.asp

and the other page for looping to displaying the record set

http://www.w3schools.com/ado/ado_display.asp

Hope that helps.
David Pearson