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

很菜的有关问题,无法全文搜索.请帮忙!

2012-03-27 
很菜的问题,无法全文搜索...请帮忙!!!--#includefile conn.asp --linkhref css/css.css rel st

很菜的问题,无法全文搜索...请帮忙!!
<!--#include   file= "conn.asp "-->
<link   href= "css/css.css "   rel= "stylesheet "   type= "text/css "   />    
    <%  
                  '建立CONNECTION对象并打开数据库
          set   sql=server.createobject( "ADODB.CONNECTION ")
                    sql.open.con     %>
                    <% '创建Recordset对象的例程,打开Recordset对象传递SQL串以及所有的连接信息%>
                    <%   set   rs=server.createobject( "ADODB.Recordset ")
                  sql= "select   *   from   products   where   "   &   name   &   "   like   '% "   &   tel   &   "% ' "
  rs.open   sql,conn,1,3
 
    '   建立查询后的显示信息和查询页面,你想取什么名字都可以
                    %>
                 
                    <html> <head> <title> 查询结果 </title> </head>
                    <body   bgcolor= "#ffffff ">
                    <p   align= "center "> <br>
                    "统计查询共有 <%   Response.Write(RS.RecordCount)   %> 条纪录 </p> <br>
                    <div   align= "center "> <center>
                    <table   border= "1 "   align= "center "   bordercolor= "000000 "   berdorcoorlight= "#000000 "   bordercolordark= "#ffffff ">
                    <tr   align= "center ">
                    <td   width= "20% "   align= "center "   bgcolor= "#ffffff "> ID </td>
                    <td   width= "60% "   align= "center "   bgcolor= "#ffffff "> 姓名 </td>
                    <td   width= "20% "   align= "center "   bgcolor= "#ffffff "> 电话 </td> </table>
                    <table   border= "1 "   align= "center "   bordercolor= "000000 "   berdorcoorlight= "#000000 "   bordercolordark= "#ffffff ">
                    <tr   align= "center ">
                    <!--从数据库提取信息-->
                    <%   while   not   rs.eof   %>


                    <tr   align= "center ">
                    <td   width= "20% "   align= "center "   bgcolor= "#ffffff "> <%   =rs( "id ")   %> </td>
                    <td   width= "60% "   align= "center "   bgcolor= "#ffffff "> <%   =rs( "name ")   %> </td>
                    <td   width= "20% "   align= "center "   bgcolor= "#ffffff "> <a   href= " <%   =rs( "tel ")   %> "> GO </a> </td>
                    <%   rs.movenext   %> </tr>         <%   wend   %> </table> </center> </div> <%   rs.close   %>
                    <%   mycon.close   %>
                    "关闭链接
                    </body> </html>
------------------------------
运行后出错..
错误类型:
Microsoft   OLE   DB   Provider   for   ODBC   Drivers   (0x80004005)
[Microsoft][ODBC   驱动程序管理器]   未发现数据源名称并且未指定默认驱动程序
/news/test.asp,   第   6   行


[解决办法]
sql= "select * from products where " & name & " like '% " & tel & "% ' "

sql= "select * from products where 此处为字段名称 like '% " & tel & "% ' "
不用加引号
sql= "select * from products where name like '% " & tel & "% ' "

热点排行