写asp的程序我真的很少用SQL Server。这次在客户的要求下,我用了。可是奇怪的是,为什么我只要把存文章的字段属性改为ntext就显示不出来了呢?在冒着丢失数据的危险修改字段属性为nvarchar后,能显示了。可是他存的数据太少了呀。
有哪位能帮忙不?多谢!
获取ntext字段的内容:
<%
strcont=Rs("content")
strcont=Replace(strcont,vbcrlf,"<br>"&vbcrlf)
response.write strcont
%>
code=chr(13)&chr(10) 读出来的要代替的字符
replacedcode="<br/>" 代替字符
temprsstring=rsstring
place=instr(temprsstring,code)查找回车字符的位置
if place<>0 then 当查找的位置不在末尾时
temprsstring=replace(temprsstring,code,replacedcode)把回车字符代替为"<br>"
end if
转换空格
code=" " 空格符
replacedcode=" " 代替字符
place=instr(temprsstring,code)查找回车字符的位置
if place<>0 then 当查找的位置不在末尾时
temprsstring=replace(temprsstring,code,replacedcode)把回车字符代替为"<br>"
end if