******请问高手,在加入ACCESS中时,如何处理回车、引号等问题?解决后给分。******

zslearning 2002-07-30 01:11:17
我用了一个表单,其中ACCESS中有一备注型字段,如何在字段中存放回车、单双引号?从数据库中读出后,又如何正确地显示这些数据?请仔细讲解。
...全文
3 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
AXQ 2002-07-30
学习!
回复
meizz 2002-07-30
<%
Function coder(str)
Dim result,L,i
If IsNull(str) Then
coder=""
Exit Function
End If
L=Len(str)
result=""
For i = 1 to L
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(13)
result=result+"<br>"
case chr(9)
result=result+"    "
case chr(32)
result=result+" "
case else
result=result+mid(str,i,1)
end select
Next
coder=result
End Function %>
回复
肄若芸 2002-07-30
function processchar(oldchar)
oldchar=replace(oldchar,"&","&")
oldchar=replace(oldchar," "," ")
oldchar=replace(oldchar,"<","<")
oldchar=replace(oldchar,">",">")
oldchar=replace(oldchar,chr(13),"<br>")
oldchar=replace(oldchar,chr(9),"    ")
oldchar=replace(oldchar,chr(10),"")''''''''少换行~~~
oldchar=replace(oldchar,"'","''")'''''''''用sql的
processchar=oldchar
end function
回复
spgoal 2002-07-30
function processchar(oldchar)
oldchar=replace(oldchar,"&","&")
oldchar=replace(oldchar," "," ")
oldchar=replace(oldchar,"<","<")
oldchar=replace(oldchar,">",">")
oldchar=replace(oldchar,chr(13),"<br>")
oldchar=replace(oldchar,chr(9),"    ")
processchar=oldchar
end function
最好是存数据的时候直接存,显示的时候用这个函数过滤就可以了
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告