ASP文本溢出

来源:百度知道 编辑:UC知道 时间:2024/06/12 23:41:34
请问如下代码如何控制文本溢出,就是想把文本控制在15个字之内
<%
i=0
sql="select top 9 cxn,cxv,id,tid,date from down where cd='电脑' order by date desc"
rs.open sql,conn,1,1
if rs.eof then%>
<tr><td width="100%" colspan="3" nowrap valign="top" height="18">还没有内容</td></tr>
<%
else
do while no

你这个程序是从数据库里面获取信息现实网页上,你现在希望对于数据库里面的常信息只现实前面15个字,对吧?

我建议从SQL语句入手,你现在的语句是:
sql="select top 9 cxn,cxv,id,tid,date from down where cd='电脑' order by date desc"

假如内容可能超过15个字的文本字段是cxv,由于不懂你的数据库结构所以只有假如了,那么SQL语句修改如下:
sql="select top 9 cxn,LEFT(cxv,15) AS CXV,id,tid,date from down where cd='电脑' order by date desc"