问:若是要显示的东东超过了单元格长度?怎么能让多余的部分不显示?

gaoqianjin 2003-12-12 03:42:57
大家帮忙!
...全文
42 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
gaoqianjin 2003-12-12
  • 打赏
  • 举报
回复
多谢
sxsgssgs 2003-12-12
  • 打赏
  • 举报
回复
CREATE PROCEDURE sp_Check
@CHKName varchar(30),@CHKPass varchar(30),
@ISValid char output
AS

if exists(select UserName from Users
where UserName=@CHKName and UserPwd=@CHKPass)
begin
select @ISValid="pass"
end
else

select @ISValid="Invalid"
GO
这个是存储过程
sxsgssgs 2003-12-12
  • 打赏
  • 举报
回复
用我的吧,就这么简单

  <%for i=1 to rs.recordcount %>
<%if rs.eof then exit For%>
<%
tit=left(rs("title"),20) & "..."

%>
<tr>
<td width="6%" height="25"></td>
<td width="94%"><%=tit%></td>
</tr>
<%rs.MoveNext
next%>
sxsgssgs 2003-12-12
  • 打赏
  • 举报
回复
<%
tit=left(rs("title"),20) & "..."

%>
<table>
<tr>
<td width="94%"><%=tit%></td>
</tr>
</table>
xiejunhua 2003-12-12
  • 打赏
  • 举报
回复
2)
用函数:lefttrue()-----如果字符串str的长度大于n,则显示左边的n个字符

Function LeftTrue(str,n) '把n设为你最多显示的个数
If len(str)<=n/2 Then
LeftTrue=str
Else
Dim TStr
Dim l,t,c
Dim i
l=len(str)
TStr=""
t=0
for i=1 to l
c=asc(mid(str,i,1))
If c<0 then c=c+65536
If c>255 then
t=t+2
Else
t=t+1
End If
If t>n Then exit for
TStr=TStr&(mid(str,i,1))
next
LeftTrue = TStr & "…"
End If
End Function

Primer2002cn 2003-12-12
  • 打赏
  • 举报
回复
单元格长度可以用一个变量(strLength)来指定

if len(rs("value"))<=strLength then
response.write rs("Value")
else
response.write left(rs("value"),strLength-3) & "..."
end if
swich 2003-12-12
  • 打赏
  • 举报
回复
left(rs("content"),你想要的字节数)
xiejunhua 2003-12-12
  • 打赏
  • 举报
回复
<table style="TABLE-LAYOUT: fixed" width="100%" border="0" cellspacing="0">
<tr>
<td style="LEFT: 0px; WIDTH: 100%; WORD-WRAP: break-word">[效果]<br>连串省略</td>
</tr>
</table>
whb147 2003-12-12
  • 打赏
  • 举报
回复
你先估计你的单元格能够显示多长,然后用
假如为20
if len(rs("neirong"))<=20 then
rsponse.write rs("neirong")
else
rsponse.write left(rs("neirong"),20)
end if

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧