Nulla con error resume... sempre lo stesso.
Il file utilizza dei file INCLUDE nei quali sono definiti i tipi di DB da utilizzare, le variabili di configurazione e le sessioni. Credo che il problema risieda in questi file.... li posto anche sono lunghi
SHOP_DB.asp
--------------------------------------
<!-- #include file="shop$config.asp" -->
<!-- #include file="shop$language.asp" -->
<!-- #include file="shop$colors.asp" -->
<!-- #include file="shopvbs.asp" -->
<!-- #include file="shopsess.asp" -->
righe di codice per definire variabili.......segue
Sub ShopOpenDataBase (connection)
'Sess ("db")= needs to be set to access file name or ODBC connection
dim databasetype
databasetype=ucase(xdatabasetype)
ShopInit
if xLCID<>"" then
Session.LCID=xLCID ' set user supplied LCID
end if
CheckValidLogin
If databasetype="" or databasetype="DRIVE" then
ProcessAccessOpen connection
exit sub
end if
if databasetype="ODBC" then
database= GetSess("db")
ProcessODBC connection
exit sub
end if
if databasetype="SQLSERVER" then
ProcessSQLServer connection
exit sub
end if
end sub
'******************************************************
' Open Access Database
Sub ProcessAccessOpen(connection)
dim dblocation
dim strconn
dim database
database=GetSess("db") & ".mdb" ' database name
dblocation=GetSess("dblocation")' location
If dblocation<>"" then
database = GetSess("dblocation") & "/" & database
end if
if ucase(xdatabasetype)="DRIVE" Then
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & database
else
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(database)
end if
if xdebug="Yes" then
debugwrite strconn
end if
Set connection = Server.CreateObject("ADODB.Connection")
on error resume next
connection.open strConn
SetSess "dbc", connection
If connection.errors.count> 0 then
SetSess "Openerror", "Open Messages<br>" & connection.errors(0).description & " <br>" & GetSess("dbc")
else
SetSess "Openerror",""
end if
End Sub
'******************************************************************************
Sub ProcessODBC (connection)
on error resume next
dim strconn
Set connection = Server.CreateObject("ADODB.Connection")
strconn=GetSess("db") ' xdatabase = ODBC connection
connection.open strConn
SetSess "dbc", connection
If connection.errors.count> 0 then
SetSess "Openerror", "Open Messages<br>" & connection.errors(0).description & " <br>" & GetSess("dbc")
else
SetSess "Openerror", ""
end if
end sub
righe di codice per definire altri tipi di DB......not important
Come vedi fa riferimento sia a variabili che sono definite in SHOP_CONFIG.ASP ( es. xdatabasetype) che a variabili di sessione GETSESS definite in SHOPSESS.ASP
Questi gli altri due file
SHOP_CONFIG.ASP
----------------------------------
<%
const xDatabase="shopping300" 'Database name
const xdblocation="db" 'location of database relative to files
const xdatabasetype="" ' database type; Drive, Default Access, can be ODBC, SQLServer
const xssl="" ' secure site location
'const xcheckout="shopcheckout.asp" ' Electronic payment system
const xcheckout="BSShopcheckout.asp" ' Electronic payment system
seguono altre constant not important
%>
--------------------------------------------------------------------------
SHOPSESS.ASP
-------------------------------------------------------------------
<%
const xUseCookies="No"
'const xUseCookies="Yes"
'***************************************************************
' maintains state for using cookies or session variables
' Cookies are not currently supported
'***************************************************************
const CookieKey="VPASP"
Sub SetSess (field, value)
If xUseCookies<>"Yes" then
Session(field)=value
else
' debugwrite field & " value=" & value
Response.cookies(Cookiekey) (field)=value
end if
end sub
'
Sub SetSessA (field, value)
dim a(3)
If XUseCookies<>"Yes" Then
Session(field)=value
exit sub
end if
dim dataarea, key, keycount,i
key = field
if ucase(key)="MYCART" then
SessSaveCart field, value, cookiekey,1
exit sub
end if
keycount=ubound(value)
dataarea=""
for i = 0 to keycount
dataarea=DataArea & value(i) & ";"
next
Response.cookies(Cookiekey) (field)=dataarea
end sub
'
Function GetSess (field)
dim value
if xUseCookies<>"Yes" then
value=Session(field)
Getsess=value
else
value=Request.cookies(Cookiekey) (field)
Getsess=value
end if
End Function
Function GetSessA (field)
dim dataarea, temparray(100), tempcount, rc
dim value, i, key, cartcount
If xUseCookies<>"Yes" then
value=Session(field)
GetsessA=value
exit function
end if
key = field
if ucase(key)="MYCART" then
SessRestoreCart field, value, cartcount, CookieKey, rc
GetSessA=value
exit function
end if
dataarea=Request.cookies(Cookiekey) (field)
If dataarea="" then
GetSessA=""
exit function
end if
ParseRecord dataarea, TempArray, tempcount, ";"
GetSessA=Temparray
End Function
Sub SetSessionTimeout
If XuseCookies<>" Yes" then
If xSessionTimeout<>"" then
Session.timeout=xsessiontimeout
end if
exit sub
end if
Response.Cookies(cookiekey).expires = date+1
end sub
Sub SaveCustomerDetailsCookie
WriteCookie "Firstname", strFirstname
WriteCookie "Lastname", strLastname
WriteCookie "Custother1" , strcustother1
WriteCookie "Address", strAddress
WriteCookie "City", strCity
WriteCookie "State", strState
WriteCookie "PostCode", strPostCode
writeCookie "Country", strCountry
WriteCookie "Company", strCompany
WriteCookie "Website", strWebsite
WriteCookie "Phone", strPhone
WriteCookie "Email", strEmail
WriteCookie "CustomerID", strCustomerID
WriteCookie "Custdiscount", strdiscount
WriteCookie "Customerid", strcustomerid
end sub
Sub RestoreCustomerDetailsCookie
dim restored
restored=Session("Restored")
if restored<>"" then exit sub
ReadCookie "Lastname", strLastname
If strlastname="" then exit sub
ReadCookie "Firstname", strFirstname
ReadCookie "Address", strAddress
ReadCookie "City", strCity
ReadCookie "State", strState
ReadCookie "PostCode", strPostCode
ReadCookie "Country", strCountry
ReadCookie "Company", strCompany
ReadCookie "Website", strWebsite
ReadCookie "Phone", strPhone
ReadCookie "Email", strEmail
ReadCookie "CustomerID", strCustomerID
ReadCookie "Custdiscount", strdiscount
ReadCookie "Customerid", strcustomerid
SetSess "Lastname", strlastname
Session("Restored")="Yes"
end sub
Sub WriteCookie (keyname, dataarea)
Response.cookies(Cookiekey) (keyname)=dataarea
end sub
Sub ReadCookie (keyname, dataarea)
dataarea = Request.cookies(Cookiekey) (keyname)
end sub
Sub SessSaveCart (field, value, cookiekey, cartdays)
dim expires
dim cartcount, arrcount, dataarea, j, countkeyname
dim keyname
dim i
expires=date+cartdays
cartcount=getsess("cartitem")
if cartcount="" or cartcount=0 then exit sub
'debugwrite "cartcount=" & cartcount
for i = 1 to cartcount
dataarea=""
for j = 1 to cartAttributes
dataArea= dataarea & value(j, i) & ";"
next
keyname= field & cstr(i)
' debugwrite keyname & " " & dataarea & " " & cookiekey
Response.cookies(Cookiekey) (keyname)=dataarea
Response.cookies(Cookiekey).expires=expires
next
countkeyname="CartCount"
Response.cookies(Cookiekey) (countkeyname)=cartcount
Response.cookies(Cookiekey).expires=expires
end sub
'
Sub SessRestoreCart (field, value, cartcount, cookiekey, rc)
dim arrcount, dataarea, Temparray(20), tempcount
dim arrcart
dim i, j, keyname, countkeyname
rc=0
ReDim arrcart(cartAttributes,maxCartItems)
value=arrcart
countkeyname="CartCount"
cartcount=Request.cookies(Cookiekey) (countkeyname)
If cartcount="" or Cartcount=0 then
rc=4
exit sub
end if
ReDim arrcart(cartAttributes,maxCartItems)
value=arrcart
for i = 1 to cartcount
keyname= field & cstr(i)
dataarea=Request.cookies(Cookiekey) (keyname)
ParseRecord dataarea, TempArray, tempcount, ";"
for j = 1 to cartAttributes
value(j,i)= temparray(j-1)
next
next
end sub
%>
----------------------------------------------------------------------
Ora spero che non me ne vorrai per questo post molto lungo.......ma a problemi complessi, ci vogliono post complessi. Spero che tu mi possa essere utile...........Helpissimo. E thank you