Salve a tutti, pur avendolo fatto decine di altre volte senza problemi (per altri script) questa volta non mi riesce di farlo correttamente.
Parlo della configurazione del file common per far connettere lo script al database.
Ora... il file common è nella cartella directry. La cartella directory è così posizionata:
wwwroot/directory/
Il database è in mdb-database
wwwroot/mdb-database
Quello che segue è il file common
codice:Dim adoCon 'Database Connection Variable Dim rsConfiguration 'Holds the configuartion 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 intRecordsPerPage 'Holds the number of files shown on each page Dim strBgColour 'Holds the background colour Dim strTextColour 'Holds the text colour Dim strTextType 'Holds the font type Dim intTextSize 'Holds the font size Dim strLinkColour 'Holds the link colour Dim strTableColour 'Holds the table colour Dim strTableBorderColour 'Holds the table border colour Dim strVisitedLinkColour 'Holds the visited link colour Dim strHoverLinkColour 'Holds the mouse over link colour 'Declare constants ' ----------------- Change the following line to the number of entries you wish to have on each page and miniumum word length ------------------------ Const intMinuiumSearchWordLength = 2 'Change this to the minimum word length to be searched on '------------------------------------------------------------------------------------------------------------------------------------- 'Create database connection 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") '------------- 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=" & Server.MapPath("../search_engine.mdb") 'Database driver for Brinkster 'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/USERNAME/db/search_engine.mdb") 'This one is for Brinkster users place your Brinster username where you see USERNAME 'Alternative drivers faster than the basic one above 'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("../search_engine.mdb") 'This one is if you convert the database to Access 97 'strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../search_engine.mdb") '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 an active connection to the Connection object adoCon.Open strCon 'Read in the configuration for the script 'Intialise the ADO recordset object Set rsConfiguration = Server.CreateObject("ADODB.Recordset") 'Initialise the SQL variable with an SQL statement to get the configuration details from the database strSQL = "SELECT tblConfiguration.* From tblConfiguration;" 'Query the database rsConfiguration.Open strSQL, strCon 'If there is config deatils in the recordset then read them in If NOT rsConfiguration.EOF Then 'Read in the configuration details from the recordset intRecordsPerPage = CInt(rsConfiguration("No_records_per_page")) strBgColour = rsConfiguration("bg_colour") strTextColour = rsConfiguration("text_colour") strTextType = rsConfiguration("text_type") intTextSize = CInt(rsConfiguration("text_size")) strLinkColour = rsConfiguration("links_colour") strTableColour = rsConfiguration("table_colour") strTableBorderColour = rsConfiguration("table_border_colour") strVisitedLinkColour = rsConfiguration("visited_links_colour") strHoverLinkColour = rsConfiguration("active_links_colour") End If 'Reset server object Set rsConfiguration = Nothing %>




Rispondi quotando
