最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp提示無效使用?Null:?Replace的解決方法

 更新時(shí)間:2023年08月01日 01:18:15   投稿:mdxy-dxy  
這篇文章主要介紹了asp提示無效使用?Null:?Replace,需要的朋友可以參考下

asp下載使用REPLACE來將數(shù)據(jù)庫里讀出來的數(shù)據(jù)替換,如果字段不為空是正常,但如果為空時(shí)就出現(xiàn)以下提示:

Microsoft VBScript 運(yùn)行時(shí)錯(cuò)誤 錯(cuò)誤 '800a005e'

無效使用 Null: 'Replace'

主要問題就是sqlserver的字段為null,所以不能簡單的為空判斷,只能使用isnull

可以先判斷

if isnull(rs("coutent"))=false then
response.write("null")
else
response.write replace(rs("coutent"),chr(13),"")
end if

或者

if rs("coutent")="" then
response.write("null")
else
response.write replace(rs("coutent"),chr(13),"")
end if

測試:

if isnull(keyword)=true then keyword=dxy_title
if isnull(descriptions)=true then descriptions=dxy_title

asp replace函數(shù)

Replace語法

Replace(expression, find, replacewith[, compare[, count[, start]]])

Replace 函數(shù)參數(shù)

expression:必選。 字符串表達(dá)式 包含要替代的子字符串。 
find: 必選。被搜索的子字符串。
replacewith :必選。用于替換的子字符串。
start: 可選。expression 中開始搜索子字符串的位置。如果省略,默認(rèn)值為 1。在和count 關(guān)聯(lián)時(shí)必須用 
count :可選。執(zhí)行子字符串替換的數(shù)目。如果省略,默認(rèn)值為 -1,表示進(jìn)行所有可能的替換。在和 start 關(guān)聯(lián)時(shí)必須用。
compare: 可選。指示在計(jì)算子字符串時(shí)使用的比較類型的數(shù)值。有關(guān)數(shù)值,請參閱“設(shè)置”部分。如果省略,缺省值為 0 ,這意味著必須進(jìn)行二進(jìn)制比較。

設(shè)置

compare 參數(shù)可以有以下值:
常數(shù) 值 描述
vbBinaryCompare 0 執(zhí)行二進(jìn)制比較。
vbTextCompare 1 執(zhí)行文本比較。

下面一個(gè)就是替換“'”為“''”

Function strReplace(Str)
 dim tempcheckstr
 tempcheckstr=Str
 If Isnull(tempcheckstr) Then
  strReplace = ""http://這里要注意,如果字符串為空,那replace裝會(huì)出錯(cuò)
  Exit Function
 End If
 strReplace = Replace(tempcheckstr,"'","''")
End Function 

到此這篇關(guān)于asp提示無效使用 Null: Replace的文章就介紹到這了,更多相關(guān)Null Replace內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

吉安县| 富川| 道真| 海原县| 株洲市| 兴海县| 沙河市| 临澧县| 兰考县| 万载县| 灵山县| 沐川县| 三都| 鹰潭市| 阳山县| 衡水市| 扶余县| 措勤县| 浪卡子县| 许昌市| 建德市| 万山特区| 德钦县| 永昌县| 辽源市| 怀仁县| 汝城县| 招远市| 永泰县| 松阳县| 论坛| 固原市| 赞皇县| 高尔夫| 崇文区| 遂平县| 云龙县| 曲水县| 米脂县| 陆河县| 通化县|