中国梦传递青春正能量:asp图片循环显示问题

来源:百度文库 编辑:高校问答 时间:2024/04/30 04:08:26
<%
Const New_img=10
set rs_Product=server.createobject("adodb.recordset")
sqltext="select top " & New_img & " * from Product where Passed=True order by UpdateTime desc"
rs_Product.open sqltext,conn,1,1
if not rs_Product.EOF then%>
<div align='center' id='demo' style='overflow:hidden;height:125px;width:545px;'>
<table align='center' cellpadding='0' cellspace='0' border='0'>
<tr>
<td id='demo1' valign='top'>
<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
<tr valign='top'>
<%
while not rs_Product.EOF
fileExt=lcase(getFileExtName(rs_Product("DefaultPicUrl")))
%>

这是图片显示的代码,怎么运行了提示错误:
类型不匹配: 'getFileExtName'
/hemei/newsproduct.asp, 第 16 行
fileExt=lcase(getFileExtName(rs_Product("DefaultPicUrl")))这行

function getFileExtName(filename)
pos=instrrev(filename,".")
if pos>0 then
getFileExtName=mid(filename,pos+1)
else
getFileExtName=""
end if
end function

是用了这个获取文件后缀名的函数么?
你的rs_Product("DefaultPicUrl")返回的值是字符串类型么?不妨把:
fileExt=lcase(getFileExtName(rs_Product("DefaultPicUrl"))) 改成
fileExt=lcase(getFileExtName(cStr(rs_Product("DefaultPicUrl"))))
要么就检查一下你的DefaultPicUrl字段是否是字符串类型的

rs_Product("DefaultPicUrl")存的是什么类型,是文本还是链接?
你看这样行不
fileExt=lcase(getFileExtName(cstr(rs_Product("DefaultPicUrl"))))
cstr转为文本类型

有这个才行::function getFileExtName(fileName)
dim pos
pos=instrrev(filename,".")
if pos>0 then
getFileExtName=mid(fileName,pos+1)
else
getFileExtName=""
end if
end function

fileExt=lcase(getFileExtName(rs_Product("DefaultPicUrl")))