用SQL读取数据控制长度 select title from news 比如读取title字段的值,长度超过20就用“...”表示,用SQL语句怎么写啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select case titlewhen len(title)>20 then SUBSTRING(title,0,19)+'...'ELSE titleEND form news select (case title when len(title)>20 then substring(title,0,19)+'...' ELSE title END) as title form news 1楼可以,另外,还可以写个公共的方法,截取指定长度的字符串并加...,然后再需要的地方调用。比如:public static string CutString(string input,int MaxLength){ if(input.Length>MaxLength) { return input.SubString(0,MaxLength)+"..."; } else { return input; }} 大可不必这样 如果楼主要做web程序直接在css里设置样式就能达到这个效果 select (case when len(title)>20 then substring(title,0,19)+'...' ELSE title END) as title form news repeater绑定数据的问题 C#怎样制作OXC,用于Delphi 图书系统如何显示信息 iis 发布后在ie7中 未能找到路径 js document.all.Buttonreg.disabled="true"; 分享我所理解的c#中的委托『原创』 两个GridView的问题 自定义控件的两个问题 关于DataGrid选中行变色的问题? 从表单取值的问题 请高手帮忙,关于.net邮件发送的问题!谢谢! asp.net中my97日期控件的用法
case title
when len(title)>20 then SUBSTRING(title,0,19)+'...'
ELSE title
END
form news
ELSE title END) as title
form news
{
if(input.Length>MaxLength)
{
return input.SubString(0,MaxLength)+"...";
}
else
{
return input;
}
}
select (case when len(title)>20 then substring(title,0,19)+'...'
ELSE title END) as title
form news