| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 931 人关注过本帖
标题:[求助]请问为什么会报错?请大家帮帮忙
取消只看楼主 加入收藏
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
 问题点数:0 回复次数:9 
[求助]请问为什么会报错?请大家帮帮忙

<script language="vbscript" runat="server"> '''电话号码转换 function change(callid) if mid(callid,1,2) = "13" then change = callid elseif mid(callid,1,3) = "013" then change = callid elseif len(callid) >= 11 then change = mid(callid,len(callid)-6,7) else change = callid end if end function '''''''''''''''''''''''''''''''''''''''''''''''' Function DataToRsStatic(Conn,strSql) Dim RsStatic On Error Resume NexT Set DataToRsStatic = Nothing If Conn Is Nothing Then Exit Function End If Set RsStatic = CreateObject("ADODB.RecordSet") RsStatic.CursorLocation = 3 RsStatic.Open strSql,Conn,3,3 If Err.Number <> 0 Then Exit Function End If set DataToRsStatic = RsStatic End Function

</script> dim CallerID CallerID = request.QueryString("m_CallerID") CallerID = change(CallerID) response.Write(CallerID) Dim conn Set Conn = CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=192.168.0.100;DATABASE=aa;UID=sa;PWD="aa" strSql = "SELECT * FROM T_Customerinfo where Chandset1 = '" & CallerID & "' or Chandset2 = '" & CallerID & "' or Ctel like '%" & CallerID & "'" set rstData = DataToRsStatic(conn, strSql)

rstData.CacheSize = NumPerPage if rstData.eof or rstData.bof then response.Write("<br>没有该客户资料<br>") else .... 当搜索到数据库里有的时候可以正常显示,当没有时候页面会显示“没有该客户资料”,但会有一个错误说:语法错误“,其他什么提示都没有,请问这是什么原因啊?

[此贴子已经被作者于2005-10-25 13:04:11编辑过]

搜索更多相关主题的帖子: 会报 
2005-10-25 12:59
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
错误提示就“语法错误”4个字,当数据里有的时候,也就是执行else的时候是正常的,但是执行THEN的时候可以正常显示response.Write("&lt;br&gt;没有该客户资料&lt;br&gt;")这句话 在页面左下角就会有错误语法的提示
2005-10-25 13:13
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
他说错误是21行,55字符,代码0,也就是
elseif len(callid) &gt;= 11 then
 change = mid(callid,len(callid)-6,7)
 else
 change = callid
 end if
end function
这些,请问这里有什么不对
2005-10-25 13:15
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 

是的没有说 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="../Css/style.css" type="text/css"> <style type="text/css"> <!-- .style1 {color: #666666} --> </style>

<script language="javascript" type="text/JavaScript"> function openwin(){ var wcurl = "../wwww/particular.asp?CustomerSID=" + ; window.open (wcurl); } </script> </head>

<body> <b><font face="Wingdings" style="FONT-SIZE: 12pt; WIDTH: 20px; COLOR: #666666">)</font>客户资料</b><br> 2210<br>没有该客户资料<br>

</body> </html> 他页面上这样的,我估计是不是JSP的语句不对

2005-10-25 13:23
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 

是JSP的问题,我删除了就没有问题了,请问这句话应该怎么改 </script>

<script language="javascript" type="text/JavaScript"> function openwin(){ var wcurl = "../wwww/particular.asp?CustomerSID=" + <% =CustomerSID %>; window.open (wcurl); } </script> response.Write("<INPUT TYPE=BUTTON VALUE=详细 onClick=""JavaScript:openwin();"">") 我是想做一个显示详细信息的按钮的

2005-10-25 13:31
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 

<!--#include file="config.asp"--> <!--#include file="conn.asp"--> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="../Css/style.css" type="text/css"> <style type="text/css"> <!-- .style1 {color: #666666} --> </style> <script language="vbscript" runat="server"> '''电话号码转换 function change(callid) if mid(callid,1,2) = "13" then change = callid elseif mid(callid,1,3) = "013" then change = callid elseif len(callid) >= 11 then change = mid(callid,len(callid)-6,7) else change = callid end if end function '''''''''''''''''''''''''''''''''''''''''''''''' Function DataToRsStatic(Conn,strSql) Dim RsStatic On Error Resume NexT Set DataToRsStatic = Nothing If Conn Is Nothing Then Exit Function End If Set RsStatic = CreateObject("ADODB.RecordSet") RsStatic.CursorLocation = 3 RsStatic.Open strSql,Conn,3,3 If Err.Number <> 0 Then Exit Function End If set DataToRsStatic = RsStatic End Function

</script>

<script language="javascript" type="text/JavaScript"> function openwin(){ var wcurl = "../wwww/particular.asp?CustomerSID=" + <% =CustomerSID %>; window.open (wcurl); } </script> </head>

<body> <b><font face="Wingdings" style="FONT-SIZE: 12pt; WIDTH: 20px; COLOR: #666666">)</font>客户资料</b><br> <% '''''''''''''''''''''''''''''''''''''''''''' Const NumPerPage = 1 ''''''''''''''''''''''''''''''''''''''''''''' Dim CurPage If Request.QueryString("CurPage") = "" then CurPage = 1 'We're on the first page Else CurPage = Request.QueryString("CurPage") End If ''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''

dim CallerID CallerID = request.QueryString("m_CallerID") CallerID = change(CallerID) response.Write(CallerID) Dim conn Set Conn = CreateObject("ADODB.Connection") conn.open "DRIVER={SQL Server};SERVER=192.168.0.100;DATABASE=ZhongRuan;UID=sa;PWD=didwell" strSql = "SELECT * FROM T_Customerinfo where Chandset1 = '" & CallerID & "' or Chandset2 = '" & CallerID & "' or Ctel like '%" & CallerID & "'" set rstData = DataToRsStatic(conn, strSql)

rstData.CacheSize = NumPerPage if rstData.eof or rstData.bof then response.Write("<br>没有该客户资料<br>") else rstData.CacheSize = NumPerPage rstData.MoveFirst rstData.PageSize = NumPerPage Dim TotalPages TotalPages = rstData.PageCount rstData.AbsolutePage = CurPage

Dim count dim CustomerSID Count = 0 Do While Not rstData.EOF And Count < rstData.PageSize %> <table table cellspacing=1 cellpadding=0 border=0 width="52%" bgcolor="#c3bfb3"> <tr> <td width="192" bgcolor="#CCCCCC" class="td-detail"><div align="left">注册帐号</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cnickname") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">会员姓名</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cname")%></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">性别 </div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Csex")%></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">家庭住址</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Caddress")%></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">手机1</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Chandset1")%></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">手机2</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Chandset2") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"><div align="left">固定电话区号</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Ctelfirst") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">固定电话号码</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Ctel") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"><div align="left">是否黑名</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cblack")%></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">会员状态</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cstatus") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"><div align="left">消费积分</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cconsumescore") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"> <div align="left">会员积分</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Cscore") %></div></td> </tr> <tr> <td bgcolor="#CCCCCC" class="td-detail"><div align="left">会员级别</div></td> <td width="203" bgcolor="#FFFFFF"><div align="center"><%= rstData("Clevel") %></div></td> </tr> </table> <% Count = Count + 1 CustomerSID = rstData("CustomerSID") rstData.MoveNext Loop Response.Write("<br><br><br>第 " & CurPage & " 条记录,共 " & TotalPages & "条记录<P>")

'显示 Next / Prev 按钮 if CurPage > 1 then Response.Write("<INPUT TYPE=BUTTON VALUE=上一条 ONCLICK=""document.location.href='ddd.asp?m_CallerID=" & CallerID & "&curpage=" & curpage - 1 & "';"">") End If

if CInt(CurPage) <> CInt(TotalPages) then Response.Write("<INPUT TYPE=BUTTON VALUE=下一条 ONCLICK=""document.location.href='ddd.asp?m_CallerID=" & CallerID & "&curpage=" & curpage + 1 & "';"">") End If

response.Write("<INPUT TYPE=BUTTON VALUE=详细 onClick=""JavaScript:openwin();"">")

rstData.Close Set rstData = nothing conn.close Set conn=Nothing end if %>

</body> </html> 这是我全部的代码

2005-10-25 13:33
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
行:21 字符:55 错误:语法错误 代码:0 url:http://localhost/wwww/ddd.asp?m_CallerID=2210

[此贴子已经被作者于2005-10-25 13:47:36编辑过]

2005-10-25 13:46
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
请问为什么有数据的时候没错,应该怎样改,谢谢
2005-10-25 14:42
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
请问有没有其他的方法可以取到CustomerSID值
2005-10-25 15:55
lihaoru
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2004-11-11
收藏
得分:0 
CustomerSID是数据库里的ID,也就是数据库里的唯一标识
2005-10-25 16:33
快速回复:[求助]请问为什么会报错?请大家帮帮忙
数据加载中...
 
   



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

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