| <%@ Language="VBScript" %> | <% Option Explicit %> |
|---|---|
|
Basic News Management System
<%
'declare your variables
Dim Connection, sConnString, SQL, Recordset
'declare SQL statement that will query the database
SQL = "SELECT * FROM tblNews"
'create ADO connection and recordset object
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")
'define the connection string, specify database driver and the location of the database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("db/news.mdb")
'Open the connection to the database
Connection.Open(sConnString)
'Open the recordset object executing the SQL statement and returning the records
Recordset.Open SQL, connection
'Check to see if there are any records with the End of File (EOF) property
If recordset.Eof Then
Response.write "Sorry there is no current news." Else 'As there are records lets loop through the records until we come to the end Do while not recordset.Eof response.write recordset("headline") & " " response.write recordset("news_story") & " " response.write recordset("story_date") & " " 'move on to the next record recordset.movenext Loop End If 'We are done so lets close the connection and the recordset recordset.Close Set recordset = Nothing connection.Close Set connection = Nothing %> | |
| ============================================================================ | www.Codefixer.com |
| Basic News Management System
http://www.codefixer.com/tutorials/news_management_system_part1.asp
Unzip the 'news' folder, read the tutorial for an explanation.
Keep the file structure as is.
============================================================================
| |
| Hi | 2010-07-20 12:13:04 AM |
| How r u?
| |