| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2680 人关注过本帖
标题:关于类型不匹配: '[string: ""]'怎么解决
只看楼主 加入收藏
rengangyi
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-8-13
收藏
 问题点数:0 回复次数:4 
关于类型不匹配: '[string: ""]'怎么解决
从index.asp中提取 adprofession
sql="select * from adtable where adprofession="&int(request("adprofession"))
Set rs = Server.CreateObject("ADODB.Recordset")
下面分页:
<a href='view.asp?adprofession="&adprofession&"' &page="&ipagecurrent+1&"'>下一页

地址栏上显示:http://61.189.228.224/view.asp?adprofession=&page=2这上面adprofession没有数值,怎么回事?
搜索更多相关主题的帖子: string 类型 
2006-08-18 00:57
弯曲的直线
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2006-7-21
收藏
得分:0 
a href=view.asp?adprofession="&amp;request.querystring("adprofession")&amp;"&amp;page="&amp;ipagecurrent+1&gt;

上论坛感觉就象和人拼贴子
2006-08-18 08:34
rengangyi
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-8-13
收藏
得分:0 
谢谢楼上的老师,这个问题解决了,还有个问题要咨询下,谢谢!
搜索拦代码
&lt;table width="329" border='0' align='right' cellpadding='0' cellspacing='0'&gt;
  
  &lt;form method=post action="search.asp"&gt;
   
    &lt;tr align="right"&gt;
    &lt;td width="246" valign='middle'&gt;&lt;input type='text' name='keyword' id="keyword" value="请输入关键字" size='12' &gt;
          &lt;select name='adprofession'&gt;
            &lt;option value=''selected&gt;行业类别&lt;/option&gt;
            &lt;% set rs=server.createobject("adodb.recordset")
                                                                sql="select * from adprofession order by adprofession desc"
                                                                rs.open sql,conn,3,3
                                                                do while not rs.eof %&gt;
            &lt;option value="&lt;%=rs("adprofession")%&gt;"&gt;&lt;%=trim(rs("adprofessionname"))%&gt;&lt;/option&gt;
            &lt;%rs.movenext
                                                                loop
                                                                rs.close
                                                            %&gt;
          &lt;/select&gt;
          &lt;select name='adinplace'&gt;
            &lt;option value='' selected&gt;地区&lt;/option&gt;
            &lt;% set rs=server.createobject("adodb.recordset")
                                                                sql="select * from adinplace order by adinplace desc"
                                                                rs.open sql,conn,3,3
                                                                do while not rs.eof %&gt;
            &lt;option value="&lt;%=rs("adinplace")%&gt;"&gt;&lt;%=trim(rs("adinplacename"))%&gt;&lt;/option&gt;
            &lt;%rs.movenext
                                                                loop
                                                                rs.close
                                                            %&gt;
          &lt;/select&gt;      &lt;/td&gt;
      &lt;td width='83' valign='bottom' &gt;
          &lt;input name="image" type=image src='pic/search.jpg' align="middle" width=82  /&gt;      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/form&gt;
&lt;/table&gt;

search.asp程序主要搜索代码如下:
&lt;% on error resume next
             dim page,keyword,cid2,cid1
                        page=request.querystring("page")
                        if page="" then page=1
                        if not(isnumeric(page)) then page=1
                        if page&lt;1 then page=1
                        page=int(page)
                        
                        if request("sql")&lt;&gt;"" then
                      sql=request("sql")
                  else
                      keyword=trim(request("keyword"))
                      adinplace=request("adinplace")
                    adprofession=request("adprofession")
                    set function1=request("function1")
                  if keyword&lt;&gt;"" then
        sql="select * from adtable  where adname like  '%"&amp;keyword&amp;"%'"
        
    end if
    if adinplace&lt;&gt;"" then
        sql=sql&amp;" and adinplace='"&amp;cstr(adinplace) &amp; "'"
    end if
    if adprofession&lt;&gt;"" then
        sql=sql&amp;" and adprofession='"&amp;cstr(adprofession)&amp;"'"
    end if
   
end if      
                                
                      rs.open sql,conn,3,3
                      if rs.eof then
                        response.write "&lt;br&gt;无相关商品"
                        rs.close
                      else
                        rs.pagesize=10
                        totalrec=rs.recordcount
                        totalpage=rs.pagecount
                        if page&gt;totalpage then page=totalpage
                        rs.absolutepage=page
                        rs.cachesize=rs.pagesize
                        i=0
                        dim id(),adname(),adplace(),adtel(),adurl(),adphopo(),adprofession(),adinplace(),adintroduction()
                        do while not rs.eof and (i&lt;rs.pagesize)
                        i=i+1
                        redim preserve id(i),adname(i),adplace(i),adtel(i),adurl(i),adphopo(i),adprofession(i),adinplace(i),adintroduction(i)
                        id(i)=rs("id")
                        adname(i)=rs("adname")
                          adplace(i)=rs("adplace")
                        adtel(i)=rs("adtel")
                          adurl(i)=rs("adurl")
                        adphopo(i))=rs("adphopo")
                        adprofession(i)=rs("adprofession")
                        adinplace(i),)=rs("adinplace")
                        adintroduction(i)=rs("adintroduction")
                        
                        rs.movenext
                        loop
                          rs.close
                  %&gt;


怎么搜索不了?谢谢.
2006-08-18 17:00
弯曲的直线
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2006-7-21
收藏
得分:0 
把整编都贴上来,看得不是很清楚

上论坛感觉就象和人拼贴子
2006-08-18 17:25
rengangyi
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2006-8-13
收藏
得分:0 
搜索拦代码
<table width="329" border='0' align='right' cellpadding='0' cellspacing='0'>

<form method=post action="search.asp">

<tr align="right">
<td width="246" valign='middle'><input type='text' name='keyword' id="keyword" value="请输入关键字" size='12' >
<select name='adprofession'>
<option value=''selected>行业类别</option>
<% set rs=server.createobject("adodb.recordset")
sql="select * from adprofession order by adprofession desc"
rs.open sql,conn,3,3
do while not rs.eof %>
<option value="<%=rs("adprofession")%>"><%=trim(rs("adprofessionname"))%></option>
<%rs.movenext
loop
rs.close
%>
</select>
<select name='adinplace'>
<option value='' selected>地区</option>
<% set rs=server.createobject("adodb.recordset")
sql="select * from adinplace order by adinplace desc"
rs.open sql,conn,3,3
do while not rs.eof %>
<option value="<%=rs("adinplace")%>"><%=trim(rs("adinplacename"))%></option>
<%rs.movenext
loop
rs.close
%>
</select> </td>
<td width='83' valign='bottom' >
<input name="image" type=image src='pic/search.jpg' align="middle" width=82 /> </td>
</tr>
</form>
</table>








search.asp页代码:
<!--#include file="conn.asp"-->
<style type="text/css">
body {font-family: "宋体";font-size:9pt;background-color:#ffffff;margin-left:0pt;margin-top:0pt}
td,input,select {font-family:宋体;font-size:9pt; color:#000000}

A:link,A:active,A:visited {text-decoration: none; color: #555555}
A:hover {text-decoration: underline; color:#b40000}

<!--
.central {
font-family: Arial, Helvetica, sans-serif;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
background-repeat: repeat;
background-position: left top;
background-color: #790000;
}
#Layer1 {
position:absolute;
left:193px;
top:85px;
width:85px;
height:515px;
z-index:0;
overflow: scroll;
background-color: #790000;
font-family: Arial, Helvetica, sans-serif;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: capitalize;
}
.STYLE5 {color: #FFffff}
.STYLE6 {color: #FFFFFF}
-->
</style>
<style>
body {SCROLLBAR-FACE-COLOR:##FFCC99;
SCROLLBAR-HIGHLIGHT-COLOR:#790000;
SCROLLBAR-SHADOW-COLOR:#790000;
SCROLLBAR-ARROW-COLOR:#FFFFFF;
SCROLLBAR-BASE-COLOR:#000000;
SCROLLBAR-DARK-SHADOW-COLOR:#FFFFFF}
</style>
<!--#include file="head.asp"-->
<%
dim rs,sql
set rs=server.createobject("adodb.recordset")
%>


<table width="780" height="438" border="0" align="center" bgcolor="#790000" >
<tr>
<th width="93" height="320" rowspan="2"align="center" valign="top" bordercolor="#CCCCCC" scope="row"><img src="pic/profession.jpg" width="93" height="28" />
<div style="width:93;height:490;overflow-x:hidden;overflow-y:scroll">
<script>
//使元素出现横向滚动条
document.write(new Array(20).join(""))
//使元素出现纵向滚动条
document.write(new Array(20).join(""))
</script>
<table width="75%" border="0">
<tr>
<th scope="row">

<table width="87" border="0" align="left" class="central" >
<td align="center" valign="top">
<tr>
<th width="81" align="left" valign="top" class="central" scope="row">
<%
set rs=server.createobject("adodb.recordset")
sql="select * from adprofession order by adprofession desc"
rs.open sql,conn,1,1
%>
<table width="65" border="0" align="left" bgcolor="#FF0000" class="central">

<%do while not rs.eof%>
<tr align="left" valign="top">
<th align="center" background="pic/littleprofession.jpg" class="central" scope="row"><a href="search.asp"><%=rs("adprofessionname")%></a></th>
</tr>
<%
rs.movenext
loop
%>
</table>

</th>
</tr>
<td height="2" align="center" valign="top"></td>
</table></th>
</tr>
</table>
</div>
</th>
<td width="680" height="26" valign="top">
<table width="680" height="30" border="0" class="central">
<tr bordercolor="#FFFFFF">
<%
set rs=server.createobject("adodb.recordset")
sql="select * from adinplace order by adinplace asc"
rs.open sql,conn,1,1
%>
<%do while not rs.eof%>

<td width="674" align="center" valign="middle" bordercolor="#FFFFFF" background="pic/placesearch.jpg" bgcolor="#FFFFCC" class="central"><a href="search.asp"><%=rs("adinplacename")%></a></td>
<%
rs.movenext
loop
%>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top"><table width="100%" height="5" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">

<tr>
<td width=478 height="2" style="border-bottom:#cccccc 1px solid" bgcolor="f7f7f7">
<b>搜索结果</b>>> </td>
</tr>
<tr>
<td width="478">
<% on error resume next
dim page,keyword,cid2,cid1
page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)

if request("sql")<>"" then
sql=request("sql")
else
keyword=trim(request("keyword"))
adinplace=request("adinplace")
adprofession=request("adprofession")
set function1=request("function1")
if keyword<>"" then
sql="select * from adtable where adname like '%"&keyword&"%'"

end if
if adinplace<>"" then
sql=sql&" and adinplace='"&cstr(adinplace) & "'"
end if
if adprofession<>"" then
sql=sql&" and adprofession='"&cstr(adprofession)&"'"
end if

end if

rs.open sql,conn,3,3
if rs.eof then
response.write "<br>无相关商品"
rs.close
else
rs.pagesize=10
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
rs.cachesize=rs.pagesize
i=0
dim id(),adname(),adplace(),adtel(),adurl(),adphopo(),adprofession(),adinplace(),adintroduction()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve id(i),adname(i),adplace(i),adtel(i),adurl(i),adphopo(i),adprofession(i),adinplace(i),adintroduction(i)
id(i)=rs("id")
adname(i)=rs("adname")
adplace(i)=rs("adplace")
adtel(i)=rs("adtel")
adurl(i)=rs("adurl")
adphopo(i))=rs("adphopo")
adprofession(i)=rs("adprofession")
adinplace(i),)=rs("adinplace")
adintroduction(i)=rs("adintroduction")

rs.movenext
loop
rs.close
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=2>&nbsp;</td>
<td width="515" >
<%
for i=1 to ubound(id)
%>
<table width="100%" height="289" border="1" align="center" bordercolor="#660000">


<tr>
<td align="center" colspan="2" class="title" height="20"><strong>广告内容</strong></td>
</tr>
<tr>
<td width="116" height="22"><strong>广告名</strong></td>
<td width="305"><%=rs("adname")%></td>
</tr>
<tr>
<td width="116" height="21">
<strong>广告图片</strong> </td>
<td width="305"><%=rs("adphopo")%></td>
</tr>
<tr>
<td width="116" height="21">
<strong>广告联系人电话</strong> </td>
<td width="305"><%=rs("adtel")%></td>
</tr>
<tr>
<td width="116" height="21">
<strong>何地广告</strong> </td>
<td width="305"><%=rs("adplace")%></td>
</tr>
<tr>
<td width="116" height="21">
<strong>广告网址</strong> </td>
<td width="305"><%=rs("adurl")%></td>
</tr>
<tr>
<td width="116" height="19">
<strong>地区</strong> </td>
<td width="305"><%=rs("adinplace")%></td>
</tr>
<tr>
<td height="13">
<strong>所属行业</strong> </td>
<td width="305"><%=rs("adprofession")%></td>
</tr>
<tr>
<td height="89">
<strong>广告介绍</strong> </td>
<td width="305"><%=rs("adintroduction")%></td>
</tr>
<tr> </tr>
</table>

<%next%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height=10></td>
</tr>
<tr>
<td width=478 height="23">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70%" align="right">
<form method="POST" action="search.asp?page=<%=page-1%>" name=form2>
<input type="hidden" name="sql" value="<%=sql%>">
<p align="right">第<%=page%>页/共<%=totalpage%>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%if page-1>0 then%>
<a href="javascript:document.form2.submit();">上一页</a>
<%else%>
上一页
<%end if%>
</form> </td>
<td width="30%" align="left">
<form method="POST" action="search.asp?page=<%=page+1%>" name=form3>
<input type="hidden" name="sql" value="<%=sql%>">  
<%if page+1<=totalpage then%>
<a href="javascript:document.form3.submit();">下一页</a>
<%else%>
下一页
<%end if%>
</form> </td>
</tr>
</table> </td>
</tr>
</table> </td>
</tr>
</table>
<%end if%> </td>
</tr>
</table>

</td>

</tr>
</table>
<!--#include file="foot.asp"-->

[此贴子已经被作者于2006-8-18 20:33:23编辑过]

2006-08-18 20:14
快速回复:关于类型不匹配: '[string: ""]'怎么解决
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020606 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved