关于asp的程序显示SQL Server中nchar字段问题。
为什么我只要把存文章的字段属性改为ntext就显示不出来了呢?
主要有以下两种方法 ,其实差不多,只拿来当参考吧。
方法1:
1
2strcont=Rs("content")
3strcont=Replace(strcont,vbcrlf,"
``` "&vbcrlf) response.write strcont
1
2
3方法2:
4
5code=chr(13)&chr(10) '读出来的要代替的字符
6replacedcode="
7" '代替字符
8temprsstring=rsstring
9place=instr(temprsstring,code)'查找回车字符的位置
10if place<>0 then '当查找的位置不在末尾时
11temprsstring=replace(temprsstring,code,replacedcode)'把回车字符代替为"
``` " end if '转换空格 code=" " '空格符 replacedcode=" " '代替字符 place=instr(temprsstring,code)'查找回车字符的位置 if place<>0 then '当查找的位置不在末尾时 temprsstring=replace(temprsstring,code,replacedcode)'把回车字符代替为" ```
``` " end if
这是我提问后经过大家的帮助,现整理给大家。希望对大家有丁点用处。