北京小妞
著名写手
著名写手
  • 铜币0枚
  • 威望0点
  • 贡献值0点
阅读:658回复:3

ASP错误在哪里?

楼主#
更多 发布于:2005-12-03 14:41
报错信息是:Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/test_show_customer.asp,行 130


以下是代码! 高手们帮找找,我是懒的找了,整不出来了!希望一觉醒来有人能帮我解决这个问题!



<%
Option Explicit
Dim Conn
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("data/data.mdb")

Dim rs,keyword,page,sql,tcount,tpage,i,method
page=trim(request.querystring("page"))      
keyword=request.querystring("keyword")
method=request.QueryString("method")
if page="" then page="1"
Set rs=CreateObject("ADODB.RecordSet")    


if keyword="" then
sql="select * from customer order by custcode desc"
else if method="客户名称" then
sql="select * from customer where custname like '%"& keyword &"%' order by custcode desc"
else if  method="客户编码" then
    sql="select * from customer where custcode  like '%"& keyword &"%' order by custcode desc"
else if  method="客户行业"  then
    sql="select * from customer where profession  like '%"& keyword &"%' order by custcode desc"
else  if method="客户类型"   then
    sql="select * from customer where custtype  like '%"& keyword &"%' order by custcode desc"
else
  response.Redirect("test_show_customer.asp")
end if




rs.open sql,conn,1,1
rs.PageSize=10
tcount=rs.RecordCount
tpage=rs.PageCount
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<STYLE TYPE="text/css">
body {margin: 0px; font-family: Tahoma; font-size: 12px;}
table {font-family: Tahoma; font-size: 12px;}
</STYLE>


</head>
<body>
<form action="test_show_customer.asp" method="get">
  <table width="641" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
    <tr>
      <td width="65">搜索:</td>
    <td width="209"><input name="keyword" type="text" id="keyword" size="25" maxlength="25">
        ,</td>  
      <td width="196"> 按照
        <select name="method" id="method">
          <option value="客户名称" selected>客户名称</option>
          <option value="客户编码">客户编码</option>
          <option value="客户行业">客户行业</option>
          <option value="客户类型">客户类型</option>
        </select>
        方式</td>
    <td width="130"><input type="submit" name="Submit" value="查询"></td>
    </tr>
</table>
  <table width="641" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <TD> <P ALIGN="right">共有记录 <font color="red"><%=tcount%></font>条 当前为 <FONT COLOR="red"><%=page%></FONT>/<FONT COLOR="red"><%=tpage%></FONT> 页
     <A HREF="test_show_customer.asp?keyword=<%=keyword%>&method=<%= method %>&page=1" >首页</A>
          <% If page>1 Then %>
          <A HREF="test_show_customer?keyword=<%=keyword%>&method=<%= method %>&page=<%=page-1%>" >
          上页 </A>
          <% Else %>
          上页
          <% End If %>
          <% if tpage-page>0 then %>
          <A HREF="test_show_customer?keyword=<%=keyword%>&method=<%= method %>&page=<%=page+1%>" >
          下页 </A>
          <% else %>
          下页
          <% end if %>
          <A HREF="test_show_customer.asp?keyword=<%=keyword%>&method=<%= method %>&page=<%=tpage%>" >
          尾页</A></TD></tr></table>


</form>

<table width="641" border="1" align="center" cellpadding="0" cellspacing="1">
  <tr bgcolor="#999999">
    <td><font color="#0000FF">客户编码</font></td>
    <td><font color="#0000FF">客户名称</font></td>
    <td><font color="#0000FF">客户电话</font></td>
    <td><font color="#0000FF">电子邮箱</font></td>
    <td><font color="#0000FF">详细地址</font></td>
    <td><font color="#0000FF">邮政编码</font></td>
    <td><font color="#0000FF">公司主页</font></td>
    <td><font color="#0000FF">客户规模</font></td>
    <td><font color="#0000FF">员工人数</font></td>
    <td><font color="#0000FF">客户行业</font></td>
    <td><font color="#0000FF">客户类型</font></td>
    <td><font color="#0000FF">客户来源</font></td>
    <td><font color="#0000FF">客户状态</font></td>
  </tr>
<%                  
on error resume next            
rs.Move (page-1)*rs.pagesize
For i=1 to rs.PageSize
%>
  <tr bgcolor="#CCCCCC">
    <td><%= rs("custcode") %></td>
    <td><%= rs("custname")%></td>
    <td><%= rs("tel")%></td>
    <td><%= rs("email")%></td>
    <td><%= rs("CustAddress")%></td>
    <td><%= rs("PostCode")%></td>
    <td><%= rs("homepage")%></td>
    <td><%= rs("CustScope")%></td>
    <td><%= rs("StaffNum")%></td>
    <td><%= rs("profession")%></td>
    <td><%= rs("custType")%></td>
    <td><%= rs("custSource")%></td>
    <td><%= rs("custStatus")%></td>
  </tr>
<%        
rs.movenext                
If rs.EOF Then Exit For  
Next'这里是130行%>
</table>


</body>


</html>
[ 2005-12-03 14:43:43 北京小妞 修改 ]
[b] [color=#ff0036]Every breath you take Every move you make Every bond you break Every step you take I'll be watching you Every single day Every word you say Every game you play Every night you say I'll be watching you O can't you see You belong to me How my poor heart aches With every step you take Every move you make Every vow you break Every smile you fake Every claim you stake I'll be watching you[/color] [/b]
松柏
论坛版主
论坛版主
  • 铜币371枚
  • 威望39点
  • 贡献值0点
  • 社区居民
1C#
发布于:2005-12-03 14:52
Re:ASP错误在哪里?
错误在这里:
if keyword="" then
    sql="select * from customer order by custcode desc"
else if method="客户名称" then
    sql="select * from customer where custname like '%"& keyword &"%' order by custcode desc"
else if  method="客户编码" then
    sql="select * from customer where custcode  like '%"& keyword &"%' order by custcode desc"
else if  method="客户行业"  then
    sql="select * from customer where profession  like '%"& keyword &"%' order by custcode desc"
else  if method="客户类型"   then
    sql="select * from customer where custtype  like '%"& keyword &"%' order by custcode desc"
else
  response.Redirect("test_show_customer.asp")
end if

你把这个 IF 分来就就知道为什么了,看下面这个:
if a then
   b
else
  if c then
    d
  else
    e
  end if

是不是少一个 END 呢?
所以你这些 else if 要连着写成 elseif
if a then
  b
elseif c then
  d
end if

这样才对
[color=#0000FF]馋嘴蜗牛[/color] 我的博客:[url]http://osnaile.osdn.cn/[/url]
北京小妞
著名写手
著名写手
  • 铜币0枚
  • 威望0点
  • 贡献值0点
2C#
发布于:2005-12-03 17:13
Re:ASP错误在哪里?
谢谢 谢谢
[b] [color=#ff0036]Every breath you take Every move you make Every bond you break Every step you take I'll be watching you Every single day Every word you say Every game you play Every night you say I'll be watching you O can't you see You belong to me How my poor heart aches With every step you take Every move you make Every vow you break Every smile you fake Every claim you stake I'll be watching you[/color] [/b]
北京小妞
著名写手
著名写手
  • 铜币0枚
  • 威望0点
  • 贡献值0点
3C#
发布于:2005-12-03 22:23
Re:ASP错误在哪里?
首尾页都能出来,中间的却出不了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[b] [color=#ff0036]Every breath you take Every move you make Every bond you break Every step you take I'll be watching you Every single day Every word you say Every game you play Every night you say I'll be watching you O can't you see You belong to me How my poor heart aches With every step you take Every move you make Every vow you break Every smile you fake Every claim you stake I'll be watching you[/color] [/b]
游客

返回顶部