Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

File DSN

Explorer ,
Apr 29, 2007 Apr 29, 2007

Copy link to clipboard

Copied

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
TOPICS
Server side applications

Views

284
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 29, 2007 Apr 29, 2007

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines