First use access to create a new database, named Luntan, the name of the datasheet is "information", establish the following fields: "Text", "name", "Time", and set the "time" default value to now ()
<%
Set com = Server.CreateObject ("ADODB.") Connection ")
Com.open "Driver={microsoft Access DRIVER (" Luntan.mdb ");
Pwd=information;dbq= "&server.mappath (" Luntan.mdb ")
Sql= "Select*from Information order by Time Desc"
Set rs=server.createobject ("ADODB. Recordest ")
Rs.Open sql,com,3,2
If Rs. EOF or Rs. BOF Then
Response.Write "No messages."
Else
Rs. MoveFirst
While not Rs. Eof.
Response.Write rs ("name") & "posted on" &rs ("Time") & "<br>"
Response.Write rs ("text") & "<br>
Rs. MoveNext
Wend
Absoluteposition=n, (n=1,2,3 ...)
End If
%>
Then the user writes the message section. Set the Forum page as "information.asp", then
<form method=post action= "information.asp" >
Name: <input type=text size=12 name= "name" ><br>
Message: <textarea cols=30 row=4 name= "text" ></textarea><br>
<input type=submit value= "Submit" >
</form>
The last part is to log the user-submitted form data to the database,
<%
If request ("text") <>empty and request ("name") <>empty Then
Set comb=server.createobject ("ADODB. Connection ")
Comb. Open "Driver={microsoft Access DRIVER (*.mdb)};p wd=information;
Dbq= "&server.mappath (" Luntan.mdb ")
Sql= "Select*from Information"
Set rsb=server.createobject ("ADODB. Recordset ")
Rsb.open sql,comb,3,2
RSB. AddNew
RSB ("text") =request ("text")
RSB ("name") =request ("name")
Rsb.update
End If
%>