这段asp程序哪出错了??提示我类型不匹配?
这段asp程序哪出错了??提示我类型不匹配?<%ifrequest("act")="add"thenBigClassID=Replace(Replace(Left(req...
这段asp程序哪出错了??提示我类型不匹配?
<%
if request("act")="add" then
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
H_title=Replace(Replace(Left(request.Form("H_title"),200),"<","["),">","]")
H_txt=Left(request.Form("H_txt"),100000)
H_ren=Replace(Replace(Left(request.Form("H_ren"),200),"<","["),">","]")
H_key=Replace(Replace(Left(request.Form("H_key"),200),"<","["),">","]")
H_Core=Replace(Replace(Left(request.Form("H_Core"),1000),"<","["),">","]")
if H_title="" then
call sub_back("提示:\n\n对不起,请填写标题!...")
end if
if H_txt="" then
call sub_back("提示:\n\n对不起,请填写新闻内容!...")
end if
if H_key="" then
call sub_back("提示:\n\n对不起,请选择新闻推荐!...")
end if
''开始写入数据
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from H_news"
rs.open sql,conn,1,3
rs.addnew
rs("BigClassID")=BigClassID
rs("SmallClassID")=SmallClassID
rs("H_title")=H_title
rs("H_txt")=H_txt
rs("H_ren")=H_ren
rs("H_key")=H_key
rs("RDate")=now()
rs("H_Core")=H_Core
rs.update
rs.close
set rs=nothing
response.Write "<script >alert('提示:\n\n添加成功,立即返回...');location.href='news_master.asp';</script>"
response.End()
end if
%>
问题可能出在这里,,,
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
数据库里这两个字段我设的是int型,,
哪的问题呀,请指点!
错误类型:
Provider (0x80020005)
类型不匹配。
/80/admin/news_add.asp, 第 29 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
网页:
POST 123 ??? /80/admin/news_add.asp
POST Data:
H_Industry=&BigClassID=1&SmallClassID=2&H_ren=gv&H_key=1&H_title=4444&H_Core=444&H_txt=4444&Submit=%C1%A2%BC%B4%B7%A2%B2%BC
时间:
2010年1月25日, 12:41:46 展开
<%
if request("act")="add" then
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
H_title=Replace(Replace(Left(request.Form("H_title"),200),"<","["),">","]")
H_txt=Left(request.Form("H_txt"),100000)
H_ren=Replace(Replace(Left(request.Form("H_ren"),200),"<","["),">","]")
H_key=Replace(Replace(Left(request.Form("H_key"),200),"<","["),">","]")
H_Core=Replace(Replace(Left(request.Form("H_Core"),1000),"<","["),">","]")
if H_title="" then
call sub_back("提示:\n\n对不起,请填写标题!...")
end if
if H_txt="" then
call sub_back("提示:\n\n对不起,请填写新闻内容!...")
end if
if H_key="" then
call sub_back("提示:\n\n对不起,请选择新闻推荐!...")
end if
''开始写入数据
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from H_news"
rs.open sql,conn,1,3
rs.addnew
rs("BigClassID")=BigClassID
rs("SmallClassID")=SmallClassID
rs("H_title")=H_title
rs("H_txt")=H_txt
rs("H_ren")=H_ren
rs("H_key")=H_key
rs("RDate")=now()
rs("H_Core")=H_Core
rs.update
rs.close
set rs=nothing
response.Write "<script >alert('提示:\n\n添加成功,立即返回...');location.href='news_master.asp';</script>"
response.End()
end if
%>
问题可能出在这里,,,
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
数据库里这两个字段我设的是int型,,
哪的问题呀,请指点!
错误类型:
Provider (0x80020005)
类型不匹配。
/80/admin/news_add.asp, 第 29 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
网页:
POST 123 ??? /80/admin/news_add.asp
POST Data:
H_Industry=&BigClassID=1&SmallClassID=2&H_ren=gv&H_key=1&H_title=4444&H_Core=444&H_txt=4444&Submit=%C1%A2%BC%B4%B7%A2%B2%BC
时间:
2010年1月25日, 12:41:46 展开
5个回答
展开全部
先给你几点意见:
用replace之前最好先检验一下时候为空,如果不为空则判断一下是否含有您需要替换的字符,如果有才执行替换操作。
简单举例,将您的BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")做一下改变:
Dim BigClassID:BigClassID=trim(request.Form("BigClassID"))
if BigClassID<>"" then
if instr(left(BigClassID,5),"<")<>0 then
BigClassID=Replace(left(BigClassID,5),"<","[")
end if
end if
如果参数为整数,请加上整数判断和转换操作,怎样避免出现数据类型不符的情况,下面给你推荐一个函数:
Function CheckNumeric(CHECK_ID)
If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then
If CHECK_ID > 922337203685477 Then CHECK_ID = 0
If CHECK_ID < -922337203685477 Then CHECK_ID = 0
CHECK_ID = CCur(CHECK_ID)
Else
CHECK_ID = 0
End If
CheckNumeric = CHECK_ID
End Function
用法:将这个函数放置到所要用到的页面,直接用BigClassID=CheckNumeric(BigClassID)
这样BigClassID的值就是整数或者0了。
用replace之前最好先检验一下时候为空,如果不为空则判断一下是否含有您需要替换的字符,如果有才执行替换操作。
简单举例,将您的BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")做一下改变:
Dim BigClassID:BigClassID=trim(request.Form("BigClassID"))
if BigClassID<>"" then
if instr(left(BigClassID,5),"<")<>0 then
BigClassID=Replace(left(BigClassID,5),"<","[")
end if
end if
如果参数为整数,请加上整数判断和转换操作,怎样避免出现数据类型不符的情况,下面给你推荐一个函数:
Function CheckNumeric(CHECK_ID)
If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then
If CHECK_ID > 922337203685477 Then CHECK_ID = 0
If CHECK_ID < -922337203685477 Then CHECK_ID = 0
CHECK_ID = CCur(CHECK_ID)
Else
CHECK_ID = 0
End If
CheckNumeric = CHECK_ID
End Function
用法:将这个函数放置到所要用到的页面,直接用BigClassID=CheckNumeric(BigClassID)
这样BigClassID的值就是整数或者0了。
展开全部
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
改成
BigClassID=cint(Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]"))
SmallClassID=cint(Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]"))
试试
最好先加一个on error resume next语句
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
改成
BigClassID=cint(Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]"))
SmallClassID=cint(Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]"))
试试
最好先加一个on error resume next语句
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
首先你看一下你上面的数据是不是POST提交的.你用request.form接收的数据,可能你没有取到值.再者它不是数值类型的.你把它打印出来看一下..
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你说问题可能出在这里
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
那你用response.write 显示出来看一下好了,是不是int型,
BigClassID=Replace(Replace(Left(request.Form("BigClassID"),5),"<","["),">","]")
SmallClassID=Replace(Replace(Left(request.Form("SmallClassID"),5),"<","["),">","]")
那你用response.write 显示出来看一下好了,是不是int型,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
最好能将IE的错误完整提示贴出来,肯定有第几行什么的提示的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询