首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

多行查询怎么把int型转成char型

2012-02-09 
多行查询如何把int型转成char型我现在有一个多行的查询代码,能查数据库中int的代码我现在相查char类型的数

多行查询如何把int型转成char型
我现在有一个多行的查询代码,能查数据库中int的代码
我现在相查char类型的数据但我不会改
谁帮我改一下,谢谢了
下面是通过id查德,我现在想通过名字查,在数据库中id是int的   名字是char的
源码是

<!--#include   file   = "conn.asp "-->
<%   Response.Buffer=True   %>

<%
id=request( "book_name ")
id   =   replace(id,chr(13), ", ")

Set   re   =   New   RegExp
re.Pattern   =   "[   \D]+ "
re.Global   =   True
re.IgnoreCase   =   True
re.MultiLine   =   True
id=re.replace(id, ", ")
Response.Write(id& " <br/> ")
id=split(id, ", ")
dim   newarr(),n
id_count=ubound(id)
n=0
redim   newarr(id_count)
for   i=0   to   id_count
      if   id(i) <> " "   then
          newarr(n)=id(i)
  n=n+1
      end   if
next
for   i=0   to   n-1
if   i <n-1   then
id2=id2&newarr(i)& ", "
else
id2=id2&newarr(i)
end   if
next

if   id2= " "   then
response.write   " <script   language=JavaScript> alert( '请输入关键字 '); "   &   "history.back() "   &   " </script> "  
Response.End()
end   if

set   rs=   server.createobject( "adodb.recordset ")
if   xuanxiang=0   then
sql=   "select   *   from   book   where   id   in   ( "&   id2   & ") "
end   if

if   rs.bof   or   rs.eof   then
      response.write " <SCRIPT   language=JavaScript> alert( '没有要查找的内容,请重新输入! '); "   &   "history.back() "   &   " </script> "  
            end   if  
%>

<tr>
        <td   height= "41 "   colspan= "7 "   align= "center "   valign= "top "> <table   width= "100% "   border= "0 ">
                <tr>
                    <th   width= "20% "   align= "left "   scope= "col "> <span   class= "STYLE4 "> 书名 </span> </th>
                   
                    <th   width= "21% "   align= "left "   scope= "col "> <span   class= "STYLE5 "> 作者名 </span> </th>
                    <th   width= "23% "   align= "left "   scope= "col "> <span   class= "STYLE5 "> 更新日期 </span> </th>
                </tr>
<%do   while   not   rs.eof%>
                <tr>
                    <td> <span   class= "STYLE5 "> <a   href= "yuedu/biaoti.asp?id= <%=rs( "id ")%> "   target= "_blank "> <%=rs( "book_name ")%> </a> </span> </td>


                 
                    <td> <span   class= "STYLE5 "> <%=rs( "book_zuozhe ")%> </span> </td>
                    <td> <span   class= "STYLE5 "> <%=rs( "riqi ")%> </span> </td>
                </tr>
  <%
      rs.movenext
    loop
    %>        


[解决办法]
使用In 字符、数字一样
还是sql= "select * from book where name in ( "& name & ") "
但是必须把name中的单引号去掉
[解决办法]
怎么分开?具体点
[解决办法]
用convert转换就行

热点排行