[此贴子已经被作者于2007-3-23 14:54:18编辑过]
这是保存流言的代码:name=Replace(Request("txtname"),"'","''")
mail=Replace(Request("txtmail"),"'","'''")
subject=Replace(Request("txtsubject"),"'","''")
img=Request("radimg")
memo=Server.HTMLEncode(Request("txtmemo"))
memo=Replace(memo,vbCrLf,"<br>")
memo=Replace(memo," "," ")
memo=Replace(memo,"'","''")
If name=Empty or subject=Empty or memo=Empty Then
Response.Write"<center>"
Response.Write"<h3> 发言人、主题、内容没有写完整!!</h3>"
Response.Write"<a href=index.asp>回留言窗口</a>"
Response.End
End If
set cnobj=server.createobject("adodb.connection")
dbpath=server.mappath("db.mdb")
cnobj.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&dbpath
cnobj.open
sqlcmd="insert into guest(姓名,信箱,主题,图标,内容)" & "values('" & name & "','" &mail& "','" & subject & "','" & img & "','" & memo & "')"
cnObj.Execute sqlcmd
cnObj.Close
Set cnObj = Nothing
Response.Redirect "showmsg.asp"