<form action="diarysave.asp?oq=add" method="post"></form> <form action="diarysave.asp?oq=change" method="post"><form> diarysave.asp: <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn.asp"--> <% function changechr(str) str=server.htmlencode(str) str=replace(str,chr(39),"") str=replace(str,vbcrlf,"<br>") str=replace(str,chr(13),"<br>") changechr=str end function oq=request(oq) if oq<>"" then select case oq case "add" diary_title=request(diary_title) diary_weather=request(diary_weather) diary_secret=request(diary_secret) diary_mood=request(diary_mood) diary_content=request(diary_content) dddd = year(now()) & "-" & month(now()) & "-" & day(now()) set rs=server.createobject("adodb.recordset") sql="select * from zhan_diary where (diary_id is null)" rs.open sql,conn,1,3 rs.addnew rs("diary_time")=dddd rs("diary_title")=diary_title rs("diary_weather")=diary_weather rs("diary_secret")=diary_secret rs("diary_mood")=diary_mood rs("diary_content")=diary_content rs.update response.write "是否继续添加<a href='diaryedit.asp?op=add'>是</a><a href='diary.asp'>否</a>" case "change" diary_id=request(diary_id) diary_title=request(diary_title) diary_weather=request(diary_weather) diary_content=request(diary_content) sql="update set diary_title='"&diary_title&"',diary_weather='"&diary_weather&"',diary_content='"&diary_content&"' where diary_id="&diary_id conn.execute(sql) end select end if %>
这样有错吗,不知道为何更新不入数据库
[此贴子已经被作者于2005-9-22 21:27:17编辑过]