我是用asp+access,我在TEXTAREA输入的时候换行了,但存储到数据库中后是这样的,如图:
然后输出的时候显示没有换行了,中间成了一个空格。
代码是:<TEXTAREA name=explain id=explain rows=5 cols=66> </TEXTAREA>
输出时是<%=rs("explain")%>;
请问这个问题如何解决呀,谢谢了...
------解决方案--------------------
楼主啊。。。。你不看下基础的不行啊。。。
- HTML code
<!-- #include file="conn.asp"--> <title></title> <body scroll="no" marginwidth="0" leftmargin="0" topmargin="0"> <% Function codeTextarea(Byval str,Byval enType) if isNul(str) then codeTextarea = "" : Exit Function select case enType case "en" codeTextarea = replace(replace(str,chr(13)&chr(10),"<br>"),chr(32)," ") case "de" codeTextarea = replace(replace(str,"<br>",chr(13)&chr(10))," ",chr(32)) end select End Function dim sql Set cmdTemp = Server.CreateObject("ADODB.Command") Set InsertCursor = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "SELECT top 1 * FROM bao order by id desc" cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = conn InsertCursor.Open cmdTemp, , 1, 3 InsertCursor.addnew if carsortstr<>"" then InsertCursor("carsort")=carsortstr end if if Server.HTMLEncode(Request("month"))<>"" then InsertCursor("month")=codeTextarea(Request("month"),"en")''''''''''' end if if Server.HTMLEncode(Request("day"))<>"" then InsertCursor("day")=codeTextarea(Request("day"),"en") end if if Server.HTMLEncode(Request("explain"))<>"" then InsertCursor("explain") =codeTextarea(Request("explain"),"en")'''''' end if InsertCursor.Update ' response.write InsertCursor("id") ' response.End ' InsertCursor.movelast %> <script language=Javascript> <!-- alert("您已成功登记相关信息!"); window.location="nee.asp" --> </script> <% InsertCursor.close conn.close set InsertCursor=nothing set conn=nothing %>
------解决方案--------------------
试了一下,输出还是空格,看了一下数据库,里面还是以换行的形式存储在里面,
可能不是换符号的问题吧