您的位置:首页 > 数据库 > MySQL

對Mysql多行字串的處理7/10

2006-07-10 17:35 274 查看
做了一個頁面,其中User會要在TextBox3中輸入多行 ,在寫入資料庫前需要作如下處理

cone=TextBox3.text '取得輸入的多行字串
cone = cone.Replace("/", "//")'將/轉義為//
cone = cone.Replace("'", "/'")'將'轉義為/'
cone = cone.Replace("_", "/_")'將_轉義為/_
cone = cone.Replace("%", "/%")'將%轉義為/%
cone = cone.Replace("""", "/""")'將"轉義為/"

在讀取後要用JS對上述資料進行處理前,需要如下動作:

Dim ta As String = e.Item.Cells(10).Text '取得多行的字串
ta = ta.Replace(Chr(13) & Chr(10), "/r/n") '將回車換行符轉義為/r/n
js = "document.getElementById('bconent').innerText='" & ta & "';"
hyb2.Attributes.Add("onclick", js)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: