当前位置:编程学习 > C#/ASP.NET >>

标准表达式中数据类型不匹配的问题

以下为源代码
<%
bookid=trim(request("bookid"))
bookname=trim(request("bookname"))
bookprice=trim(request("bookprice"))
bookpub=trim(request("bookpub"))
bookauthor=trim(request("bookauthor"))
booknum=trim(request("booknum"))
if bookid=""then
   strquery1="1=1"
else
   strquery1="bookid="&bookid&""
end if
if bookname=""then
   strquery2="1=1"
else
   strquery2="bookname="&bookname&""
end if
if bookprice=""then
   strquery3="1=1"
else
   strquery3="bookprice="&bookprice&""
end if
if bookpub=""then
   strquery4="1=1"
else
   strquery4="bookpub="&bookpub&""
end if
if bookauthor=""then
   strquery5="1=1"
else
   strquery5="bookauthor="&bookauthor&""
end if
if booknum=""then
   strquery6="1=1"
else
   strquery6="booknum="&booknum&""
end if
sql="select * from bookInfo where "&strquery1&"and "&strquery2&"and "&strquery3&"and "&strquery4&"and "&strquery5&"and "&strquery6
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1if rs.bof and rs.eof then
   rs.close
   set rs=nothing
   conn.close
   set conn=nothing
   response.Write "没有找到符合条件的图书"
   response.End()
else
%>
<h1 align="center">搜索到的书籍信息</h1>
<table width="50%" border="1" align="center">
<tr>
   <td width="13%" align="center">图书编号</td>
   <td width="13%" align="center">图书名称</td>
   <td width="13%" align="center">图书价格</td>
   <td width="13%" align="center">图书出版社</td>
   <td width="9%" align="center">作者</td>
   <td width="13%" align="center">库存数量</td>
   <td width="13%" align="center">删除</td>
</tr>

<%
do while not rs.eof
   response.Write "<tr>"
   response.Write rs("bookid")
   response.Write rs("bookname")
   response.Write rs("bookprice")
   response.Write rs("bookpub")
   response.Write rs("bookauthor")
   response.Write rs("booknum")
   response.Write "<a href=delbook.asp?id="&rs("bookid")&">删除</a>"
   response.Write "</tr>"
rs.movenext
loop
%>   

</table>
</body>
</html>
<%
rs.close
set rs=nothing

conn.close
set conn=nothing
end if
%>
红色是出错的行 --------------------编程问答-------------------- 输出sql,看字段类型和相关值
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,