用ASP把ACCESS数据库更新问题
<!--#includefile="conn.asp"--><!--#includefile="admin.asp"--><!--#includefile="../Inc...
<!--#include file="conn.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="../Inc/Config.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim rssa2,sql2
ID=Request.Form("ID")
Title=Trim(request.form("Title"))
BigClassName=trim(request.form("BigClassName"))
Content=trim(request.form("Content"))
User=Trim(request.form("User"))
AddDate=trim(request.form("AddDate"))
Hits=trim(request.form("Hits"))
Action=trim(request("Action"))
if BigClassName="" then
founderr=true
errmsg=errmsg+"<li>未指定新闻所属大类</li>"
end if
if Title="" then
founderr=true
errmsg="<li>新闻标题不能为空</li>"
end if
if Content="" then
founderr=true
errmsg=errmsg+"<li>新闻内容不能为空</li>"
end if
if BigClassName<>"" then
sql2="select * from Y_xInfo where XInfo_Cname="&BigClassName&""
set rssa2=server.createobject("adodb.recordset")
rssa2.open sql2,conn,1,1
end if
if founderr=false then
Title=dvhtmlencode(Title)
if AddDate<>"" and IsDate(AddDate)=true then
AddDate=CDate(AddDate)
else
AddDate=now()
end if
if Hits<>"" then
Hits=CLng(Hits)
else
Hits=0
end if
set rs=server.createobject("adodb.recordset")
select case Action
case "Add"
sql="select * from Y_Information where (Y_ID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("Y_infn")=Title
rs("Y_InfC")=Content
rs("Y_InfS")=User
rs("BigClassName")=BigClassName
rs("Y_InfDate")=AddDate
rs("Y_InfClick")=Hits
rs("Y_xInfC")=rssa2("XInfo_class")
rs.update
rs.close
rssa2.close
set rs=nothing
response.redirect "News_Manage.asp"
case "Modify"
if ID<>"" then
sql="select * from Y_Information where Y_ID="&ID
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
rs("Y_infn")=Title
rs("Y_InfC")=Content
rs("Y_InfS")=User
rs("BigClassName")=BigClassName
rs("Y_InfDate")=AddDate
rs("Y_InfClick")=Hits
rs("Y_xInfC")=rssa2("XInfo_class")
rs.update
rs.close
rssa2.close
set rs=nothing
response.redirect "News_Manage.asp"
else
founderr=true
errmsg=errmsg+"<li>找不到此新闻,可能已经被删除。</li>"
end if
else
founderr=true
errmsg=errmsg+"<li>不能确定ID的值</li>"
call WriteErrMsg()
end if
Case else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
call WriteErrMsg()
end select
call CloseConn()
else
WriteErrMsg
end if
%>
请问这段代码有什么问题?
为什么我的库Y_xInfC这个字段不更新而别的都能更新呢! 展开
<!--#include file="admin.asp"-->
<!--#include file="../Inc/Config.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim rssa2,sql2
ID=Request.Form("ID")
Title=Trim(request.form("Title"))
BigClassName=trim(request.form("BigClassName"))
Content=trim(request.form("Content"))
User=Trim(request.form("User"))
AddDate=trim(request.form("AddDate"))
Hits=trim(request.form("Hits"))
Action=trim(request("Action"))
if BigClassName="" then
founderr=true
errmsg=errmsg+"<li>未指定新闻所属大类</li>"
end if
if Title="" then
founderr=true
errmsg="<li>新闻标题不能为空</li>"
end if
if Content="" then
founderr=true
errmsg=errmsg+"<li>新闻内容不能为空</li>"
end if
if BigClassName<>"" then
sql2="select * from Y_xInfo where XInfo_Cname="&BigClassName&""
set rssa2=server.createobject("adodb.recordset")
rssa2.open sql2,conn,1,1
end if
if founderr=false then
Title=dvhtmlencode(Title)
if AddDate<>"" and IsDate(AddDate)=true then
AddDate=CDate(AddDate)
else
AddDate=now()
end if
if Hits<>"" then
Hits=CLng(Hits)
else
Hits=0
end if
set rs=server.createobject("adodb.recordset")
select case Action
case "Add"
sql="select * from Y_Information where (Y_ID is null)"
rs.open sql,conn,1,3
rs.addnew
rs("Y_infn")=Title
rs("Y_InfC")=Content
rs("Y_InfS")=User
rs("BigClassName")=BigClassName
rs("Y_InfDate")=AddDate
rs("Y_InfClick")=Hits
rs("Y_xInfC")=rssa2("XInfo_class")
rs.update
rs.close
rssa2.close
set rs=nothing
response.redirect "News_Manage.asp"
case "Modify"
if ID<>"" then
sql="select * from Y_Information where Y_ID="&ID
rs.open sql,conn,1,3
if not (rs.bof and rs.eof) then
rs("Y_infn")=Title
rs("Y_InfC")=Content
rs("Y_InfS")=User
rs("BigClassName")=BigClassName
rs("Y_InfDate")=AddDate
rs("Y_InfClick")=Hits
rs("Y_xInfC")=rssa2("XInfo_class")
rs.update
rs.close
rssa2.close
set rs=nothing
response.redirect "News_Manage.asp"
else
founderr=true
errmsg=errmsg+"<li>找不到此新闻,可能已经被删除。</li>"
end if
else
founderr=true
errmsg=errmsg+"<li>不能确定ID的值</li>"
call WriteErrMsg()
end if
Case else
founderr=true
errmsg=errmsg+"<li>没有选定参数</li>"
call WriteErrMsg()
end select
call CloseConn()
else
WriteErrMsg
end if
%>
请问这段代码有什么问题?
为什么我的库Y_xInfC这个字段不更新而别的都能更新呢! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询