<% Dim adoNewsCon 'Database Connection Variable Dim rsNewsConfiguration 'Holds the configuartion recordset Dim strAdoNewsConfig 'Holds the Database driver and the path and name of the database Dim strNewsSQL 'Holds the SQL query for the database Dim intPreviewNewsItems 'Number of files shown on each page Dim blnNewsLCode 'News page code set to true Dim strNewsBgColour 'Holds the background colour of the News Administrator Dim strNewsTextColour 'Holds the text colour of the News Administrator Dim strNewsTextType 'Holds the font type of the News Administrator Dim intNewsTextSize 'Holds the font size of the News Administrator Dim intNewsSmallTextSize 'Holds the size of small fonts Dim strNewsLinkColour 'Holds the link colour of the News Administrator Dim strNewsTableColour 'Holds the table colour Dim strNewsTableBorderColour 'Holds the table border colour Dim strNewsTableTitleColour 'Holds the table title colour Dim strNewsVisitedLinkColour 'Holds the visited link colour of the News Administrator Dim strNewsActiveLinkColour 'Holds the active link colour of the News Administrator 'Create database connection 'Create a connection odject Set adoNewsCon = 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 strAdoNewsConfig = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("weekly/TestNews.mdb") '--------------------------------------------------------------------------------------------------------------------------------------------- 'Set an active connection to the Connection object adoNewsCon.Open strAdoNewsConfig 'Read in the configuration for the script 'Intialise the ADO recordset object Set rsNewsConfiguration = Server.CreateObject("ADODB.Recordset") 'Initialise the SQL variable with an SQL statement to get the configuration details from the database strNewsSQL = "SELECT tblConfiguration.* From tblConfiguration;" 'Query the database rsNewsConfiguration.Open strNewsSQL, strAdoNewsConfig 'If there is config deatils in the recordset then read them in If NOT rsNewsConfiguration.EOF Then 'Read in the configuration details from the recordset strNewsTextColour = rsNewsConfiguration("text_colour") strNewsTextType = rsNewsConfiguration("text_type") intNewsTextSize = CInt(rsNewsConfiguration("text_size")) intNewsSmallTextSize = CInt(rsNewsConfiguration("small_text_size")) strNewsTableColour = rsNewsConfiguration("table_colour") strNewsTableBorderColour = rsNewsConfiguration("table_border_colour") strNewsTableTitleColour = rsNewsConfiguration("table_title_colour") strNewsLinkColour = rsNewsConfiguration("links_colour") strNewsVisitedLinkColour = rsNewsConfiguration("visited_links_colour") strNewsActiveLinkColour = rsNewsConfiguration("active_links_colour") blnNewsLCode = CBool(rsNewsConfiguration("Code")) intPreviewNewsItems = rsNewsConfiguration("No_of_preview_items") End If 'Reset server object rsNewsConfiguration.Close Set rsNewsConfiguration = Nothing %>

<% Dim rsNews 'Database recordset holding the news items Dim intNewsItems 'Loop counter for displaying the news items 'Create recorset object Set rsNews = Server.CreateObject("ADODB.Recordset") 'Initalise the strNewsSQL variable with an SQL statement to query the database 'strNewsSQL = "SELECT TOP " & intPreviewNewsItems & " tblNews.* FROM tblNews ORDER BY News_Date DESC;" strNewsSQl = "SELECT * from tblNews where Archive = 0/index.html ORDER BY News_Date Desc;" 'Query the database rsNews.Open strNewsSQL, adoNewsCon 'If there are no news item to display then display a message seying so If rsNews.EOF Then Response.Write("Sorry, There is no Site News Items to display") 'Loop round to display each of the news items For intNewsItems = 1 to intPreviewNewsItems 'Iv there are no records then exit for loop If rsNews.EOF Then Exit For %>

<% = rsNews("News_item") %>

<% 'Move to the next record in the recordset rsNews.MoveNext Next 'Reset server objects rsNews.Close Set rsNews = Nothing Set strAdoNewsConfig = Nothing Set adoNewsCon = Nothing %>