#12005/11/29 13:55:17
问题是这样的,我在在同一个页面增加产品大类的时候要查询一下数据库里有没有相同的字符,如果有提示不能加入,现在的问题是中文大类名称的可以查询,英文大类名称的不能查询,请问下面的代码有什么问题吗?
注:中文大类的字体名为BigClassName,英文大类的字段字为en_BigClassName
<%
dim Action,BigClassName,en_BigClassName,rs,FoundErr,ErrMsg
Action=trim(Request("Action"))
BigClassName=trim(request("BigClassName"))
Action=trim(Request("Action"))
en_BigClassName=trim(request("en_BigClassName"))
if Action="Add" then
if FoundErr<>True then
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * From BigClass Where BigClassName='" & BigClassName & "'",conn,1,3
if not (rs.bof and rs.EOF) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>产品中文大类“" & BigClassName & "”已经存在!</li>"
else
rs.addnew
rs("BigClassName")=BigClassName
rs("en_BigClassName")=en_BigClassName
rs.update
rs.Close
set rs=Nothing
call CloseConn()
Response.Redirect "ClassManage.asp"
end if
end if
'''''''add english prodcution type''''''''
if FoundErr<>True then
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * From BigClass Where En_BigClassName='" & En_BigClassName & "'",conn,1,3
if not (rs.bof and rs.EOF) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>产品英文大类“" & En_BigClassName & "”已经存在!</li>"
else
rs.addnew
rs("BigClassName")=BigClassName
rs("en_BigClassName")=en_BigClassName
rs.update
rs.Close
set rs=Nothing
call CloseConn()
Response.Redirect "ClassManage.asp"
end if
end if
''''over add'''''''''''''''''''''
end if
if FoundErr=True then
call WriteErrMsg()
else
%>
编辑历史:[此帖最近一次被 Gzink 编辑过(编辑时间:2005-11-29 15:59:33)]