日期:2014-05-17  浏览次数:20907 次

请问这段程序哪里错了?为什么显示500错误??
<!--#include   file= "../config/connection.asp "   -->
<%  
'判断包含双字节字符的字符串长度  
Function   getStrLen(str)
dim   x,y,i
x   =   len(str)
y   =   0  
for   i   =   1   to   x  
if   asc(mid(str,i,1)) <0   or   asc(mid(str,i,1))> 255   then
y   =   y   +   2   '双字节  
else
y   =   y   +   1 'ascii码字符  
end   if  
next
getStrLen   =   y  
End   Function

'从指定(包含双字节字符的)字符串中第一个字符起的指定长度的字符串  
'指定的长度为单字节长度,即字节数  
Function   leftString(str,length)
dim   x,y,i,s
s=str
x   =   len(str)
y   =   0  
if   x   > =   1   then
for   i   =   1   to   x  
if   asc(mid(str,i,1))   <   0   or   asc(mid(str,i,1))   > 255   then
y   =   y   +   2  
else
y   =   y   +   1  
end   if
if   y   > =   length   then
s   =   left(str,i)   '字符串字节数
exit   for
end   if  
next  
end   if  
leftString   =   s  
End   Function  
%>  
<table>
  <tr> <td> 条码 </td> <td> 名称 </td> <td> 单位 </td> <td> 规格 </td> <td> 品牌 </td> <td> 图片 </td> <td> 产地 </td> <td> 缺货 </td> <td> 进销存同步 </td> </tr>
<%
sql= "select   *   from   webhz   order   by   id "
set   rs=server.createobject( "adodb.recordset ")
rs.open   sql,conn
do   while   rs.eof <> true
id=rs( "id ")
tiaoma=rs( "tiaoma ")
mingcheng=rs( "mingcheng ")
danwei=rs( "danwei ")
guige=rs( "guige ")
pinpai=rs( "pinpai ")
tupian=rs( "tupian ")
jianjie=rs( "jianjie ")
chandi=rs( "chandi ")
quehuo=rs( "quehuo ")

  set   rs1=server.createobject( "adodb.recordset ")
  rs1.open   "select   *   from   oraclee   where   tiaoma= "&tiaoma& " ",conn
  if   rs1.eof <> true   then%>
  <tr> <td> <%=tiaoma%> </td> <td> <%=mingcheng%> </td> <td> <%=danwei%> </td> <td> <%=guige%> </td> <td> <%=pinpai%> </td> <td> <%=tupian%> </td> <td> <%=chandi%> </td> <td> <%=quehuo%> </td> <td> 进销存同步 </td> </tr>
<%i=i+1
else   if   getStrLen( "tiaoma ")=13   then    
tiaoma2=leftString( "tiaoma ",12)
  set   rs2=server.createobject( "adodb.recordset ")
  rs2.open   "select   *   from   oraclee   where   tiaoma= "&tiaoma2& " ",conn
    if   rs2.eof <> true   then%>
  <tr> <td> <%=tiaoma%> </td> <td> <%=mingcheng%> </td> <td> <%=danwei%> </td> <