
o meu código está da seguinte maneira no arquivo common, sendo que o meu .mdb se encontra no caminho, data/database/WWGguestbook.mdb :
<%
'Declare variables
Dim adoCon 'Database Connection Variable
Dim rsCommon 'Holds the common recordset
Dim strCon 'Holds the Database driver and the path and name of the database
Dim strSQL 'Holds the SQL query for the database
Dim strDbPathAndName 'Holds the database path and name
Dim intRecordsPerPage 'Holds the number of files shown on each page
Dim strBgColour 'Holds the background colour of the guestbook
Dim strTextColour 'Holds the text colour of the guestbook
Dim strLinkColour 'Holds the link colour of the guestbook
Dim strTextType 'Holds the font type of the guestbook
Dim intTextSize 'Holds the font size of the guestbook
Dim strTableColour 'Holds the table colour
Dim strTableBorderColour 'Holds the table border colour
Dim strTableTitleColour 'Holds the table title colour
Dim strVisitedLinkColour 'Holds the visited link colour of the guestbook
Dim strActiveLinkColour 'Holds the active link colour of the guestbook
Dim strHoverLinkColour 'Holds the active link colour of the guestbook
Dim blnLCode 'set to true
Dim blnEmail 'Boolean set to true if e-mail is on
Dim strCode 'Holds the page code
Dim strCode2 'Holds the page code
Dim strWebSiteEmailAddress 'Holds the e-mail address for the web site the Guestbook is on
Dim strMailComponent 'Email coponent the guestbook useses
Dim strSMTPServer 'SMTP server for sending the e-mails through
Dim strLoggedInUserCode 'Holds the user code of the user
Dim strTitleImage 'Holds the path and name for the title image for the guestbook
Dim intMsgCharNo 'Holds the number of characters allowed for the messages
Dim blnCookieSet 'Set to true if cookies are to be set to stop multiple posts
Dim blnIPBlocking 'Set to true if IP blooking is to be used to stop multiple posts
Dim strDatabaseType 'Holds the database type
'Initiliase varibales
Const strVersion = "6.0"
Const strSalt = "5CB237B1D85"
Const strCodeField = "Code"
'Set up the database table name prefix and stored procedure prefix
'(This is useful if you are running multiple forums from one database)
' - make sure you also change this in the msSQL_server_setup.asp file if setting up an ms SQL server database)
Const strDbTable = "tblGB"
'Database Type
strDatabaseType = "Access"
'strDatabaseType = "SQLServer"
'Create database connection
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'--------------------- Set the path and name of the database --------------------------------------------------------------------------------
'Virtual path to database
strDbPathAndName = Server.MapPath("data/database/WWGguestbook.mdb") 'This is the path of the database from this files location on the server
'Physical path to database
'strDbPathAndName = "" 'Use this if you use the physical server path, eg:- C:\Inetpub\private\WWGguestbook.mdb
'BRINKSTER USERS
'Brinkster users remove the ' single quote mark from infront of the line below and replace USERNAME with your Brinkster uersname
'strDbPathAndName = Server.MapPath("/USERNAME/db/WWGguestbook.mdb")
'PLEASE NOTE: - For extra security it is highly recommended you change the name of the database, WWGguestbook.mdb, to another name and then
'replace the wwForum.mdb found above with the name you changed the forum database to.
'---------------------------------------------------------------------------------------------------------------------------------------------
'------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below --------------
'Database connection info and driver (if this driver does not work then comment it out and use one of the alternative drivers)
'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strDbPathAndName
'Alternative drivers faster than the generic one above
'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & strDbPathAndName 'This one is if you convert the database to Access 97
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName 'This one is for Access 2000/2002
'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)
'strCon = "DSN=DSN_NAME" 'Place the DSN where you see DSN_NAME
'---------------------------------------------------------------------------------------------------------------------------------------------
'Set the diffrent variables for diffrent database types
If strDatabaseType = "SQLServer" Then
%><!--#include file="includes/SQL_server_connection.asp" --><%
End If
'Set the connection string to the database
adoCon.connectionstring = strCon
'Set an active connection to the Connection object
adoCon.Open
'Read in the Guestbook configuration
'Intialise the ADO recordset object
Set rsCommon = Server.CreateObject("ADODB.Recordset")
'Initialise the SQL variable with an SQL statement to get the configuration details from the database
strSQL = "SELECT " & strDbTable & "Configuration.* From " & strDbTable & "Configuration;"
'Query the database
rsCommon.Open strSQL, strCon
'If there is config deatils in the recordset then read them in
If NOT rsCommon.EOF Then
'Read in the configuration details from the recordset
strMailComponent = rsCommon("mail_component")
strSMTPServer = rsCommon("mail_server")
strBgColour = rsCommon("bg_colour")
strTextColour = rsCommon("text_colour")
strTextType = rsCommon("text_type")
intTextSize = CInt(rsCommon("text_size"))
strLinkColour = rsCommon("links_colour")
strTableColour = rsCommon("table_colour")
strTableBorderColour = rsCommon("table_border_colour")
strTableTitleColour = rsCommon("table_title_colour")
strVisitedLinkColour = rsCommon("visited_links_colour")
strHoverLinkColour = rsCommon("active_links_colour")
strWebSiteEmailAddress = rsCommon("email_address")
blnLCode = CBool(rsCommon("Code"))
blnEmail = CBool(rsCommon("email_notify"))
intRecordsPerPage = CInt(rsCommon("Comments_per_page"))
strTitleImage = rsCommon("Title_image")
intMsgCharNo = rsCommon("Message_char_no")
blnCookieSet = CBool(rsCommon("Cookie"))
blnIPBlocking = CBool(rsCommon("IP_blocking"))
End If
'Close the recordset
rsCommon.Close
%>
Obrigado