<%@ Language=VBScript %> <%session.lcid=2057 'Format Date DD/MM/YYYY%> <% ' Set Up our Database connection via DSNLess Connection ' You May be able to use Server.MapPath for you connection ' Or alternatively connect via ODBC, Please contact your ' Hosting provider for more information ' Dimension our Variables for the Dabase Connection dim objConn, strCon, objRS, strSQL Set objConn = Server.CreateObject("ADODB.Connection") '************************************* ' CHANGE THE FOLLWING DATA SOURCE ' PATH TO POINT TO WHERE YOU HAVE ' PLACED THE NewsCMS DATABASE '************************************* 'strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ootweb\longranger\news\NewsCMS.mdb" strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Domains\thelongranger.com.au\wwwroot\news\NewsCMS.mdb" objConn.connectionstring = strCon objConn.Open Set objRS = Server.CreateObject("ADODB.Recordset") ON ERROR RESUME NEXT Dim pageView, strNewsText ' See what view the User is requesting pageView=Request.Querystring("view") %> Long Range 4WD Fuel Tank News
 
<%if pageView="" THEN ' We display the news article list %> Welcome to our News Page, please click on an article headline below to view it

<% ' Set the SQL Statement to get the information from the database strSQL="SELECT * FROM TBLNews WHERE newsStatus=1 ORDER BY newsDate DESC" ' Open the Database objRS.Open strSQL, objConn, adOpenKeyset, adLockPessimistic, adCmdText IF NOT objRS.EOF THEN 'objRS.Filter=objRS("newsStatus")=1 %>
<% ' Write out the list of articles but it will ' only show the ones that have a status of ' 1 which shows they are online DO WHILE NOT objRS.EOF%> <%if intRowColor = 0 Then Response.Write "" intRowColor = 1 Else Response.Write "" intRowColor = 0 End if%> <% objRS.MoveNext Loop objRS.Close %>
News Date News Headline
<%=FormatDateTime(objRS("newsDate"),2)%> " title="Display The Article" onmouseover="window.status='Display the article'; return true" onmouseout="window.status=''; return true"> <%=objRS("newsHeadline")%>
<%ELSE%>

There are currently no articles in the News Database to display.

<%END IF%> <%END IF%> <%IF pageView="Display" THEN ' Write out the news article the ' user has selected ' Set the SQL Statement to get the information from the database strSQL="SELECT * FROM TBLNews WHERE newsID="&Request.QueryString("ID") ' Open the Database objRS.Open strSQL, objConn, adOpenKeyset, adLockPessimistic, adCmdText%> News Home
 
<%=objRS("newsHeadline")%>

Published: <%=objRS("newsDate")%>

<% ' Format the news text and print it out strNewsText = Replace(objRS("NewsBody"), vbCrLf, "
") Response.Write strNewsText %>
<%END IF%>