i have a problem with moving ASP scripts from one local web server to another remote at Godaddy
my old notations were like this (#1)
strProvider="DSN=access_DB1"
set objConn = server.createobject("ADODB.Connection")
objConn.Open strProvider
set rst = Server.CreateObject("ADODB.recordset")
qry="SELECT recs FROM field1"
rst.Open qry, strProvider
recs=rst(0)
rst.close
Godaddy requires the following notation (#2):
dsn_name = "access_DB1"
sDSNDir = Server.MapPath("/_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
set oConn = Server.CreateObject("ADODB.Connection")
qry = "SELECT recs FROM field1"
oConn.Open connectstr
Set oRS = oConn.Execute(qry)
recs=oRs.Fields("recs")
oRS.close
Both ways work fine:
#1 - for local server
#2 - for remote
The problems are:
(a) I don't want to make too many changes in the scripts
Is there a way to minimize the changes?
(b) I would like to be able to run same web site at local server (it means that I don't want too many changes to make, i.e. only in the initial settings;
also its OK for me to switch to a notation #2 on the local server as well, but I don't know how to do that - where to put/declare DSN ( Server.MapPath("/_dsn") )
Thanks for advices.
my old notations were like this (#1)
strProvider="DSN=access_DB1"
set objConn = server.createobject("ADODB.Connection")
objConn.Open strProvider
set rst = Server.CreateObject("ADODB.recordset")
qry="SELECT recs FROM field1"
rst.Open qry, strProvider
recs=rst(0)
rst.close
Godaddy requires the following notation (#2):
dsn_name = "access_DB1"
sDSNDir = Server.MapPath("/_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
set oConn = Server.CreateObject("ADODB.Connection")
qry = "SELECT recs FROM field1"
oConn.Open connectstr
Set oRS = oConn.Execute(qry)
recs=oRs.Fields("recs")
oRS.close
Both ways work fine:
#1 - for local server
#2 - for remote
The problems are:
(a) I don't want to make too many changes in the scripts
Is there a way to minimize the changes?
(b) I would like to be able to run same web site at local server (it means that I don't want too many changes to make, i.e. only in the initial settings;
also its OK for me to switch to a notation #2 on the local server as well, but I don't know how to do that - where to put/declare DSN ( Server.MapPath("/_dsn") )
Thanks for advices.