==26個(gè) 日文 片假名 導(dǎo)致Access搜索(80040e14/內(nèi)存溢出)的解決辦法== ゴ ガ ギ グ ゲ ザ ジ ズ ヅ デ ド ポ ベ プ ビ パ ヴ ボ ペ ブ ピ バ ヂ ダ ゾ ゼ 當(dāng)字段內(nèi)包含了這26個(gè) 日文 字符任意一個(gè)多個(gè)時(shí),就會(huì)導(dǎo)致在執(zhí)行SQL語句中包含了 [字段] like %aaaaa%
==26個(gè)日文片假名導(dǎo)致Access搜索(80040e14/內(nèi)存溢出)的解決辦法==ゴ ガ ギ グ ゲ ザ ジ ズ ヅ デ ド ポ ベ プ ビ パ ヴ ボ ペ ブ ピ バ ヂ ダ ゾ ゼ
當(dāng)字段內(nèi)包含了這26個(gè)日文字符任意一個(gè)多個(gè)時(shí),就會(huì)導(dǎo)致在執(zhí)行SQL語句中包含了
[字段] like %aaaaa% 或 inStr(1,[字段],aaaaa,1)>0
這樣的查詢時(shí),毫無道理的出現(xiàn)了
"Microsoft JET Database Engine 錯(cuò)誤 80040e14 內(nèi)存溢出"的錯(cuò)誤
其他Jet SQL函數(shù)命令未作測(cè)試,大概與字符搜索定位匹配相關(guān)的都可能出錯(cuò)
搜索相關(guān)資料得知被微軟工程師證實(shí)是Access的bug,可能是語法關(guān)系都是微軟的東東
在vbs中 執(zhí)行inStr(1,日文平假名變量,"aaaaa",1)依然要出現(xiàn)錯(cuò)誤
Microsoft VBScript 運(yùn)行時(shí)錯(cuò)誤 錯(cuò)誤 800a0005 無效的過程調(diào)用或參數(shù): instr
沒有搜索,因這幾個(gè)字符出現(xiàn)Access的論壇網(wǎng)站搜索無法進(jìn)行,何等痛苦
昨天一朋友大叫怪事,他的音樂數(shù)據(jù)庫(kù)無法搜索了,只有30000條記錄時(shí)是好的
毫無疑問,日文片假名是禍根,花幾分鐘把有包含上面的日文替換成"?"搜索順利恢復(fù)
找來論壇程序用戶群最大的動(dòng)網(wǎng)dvBBS AC版本 7.0SP2 版測(cè)試,同樣有這個(gè)日文發(fā)帖后 導(dǎo)致無法搜索并且運(yùn)行時(shí)出錯(cuò)的問題
線上去搜索 80040e14 內(nèi)存溢出" 的錯(cuò)誤 多的是!
一簡(jiǎn)單有效的解決辦法:
對(duì)這26個(gè)字符進(jìn)行編碼和解碼,可能效率感覺不理想,測(cè)試下來問題不大,速度影響不是太大
編碼:
Function Jencode(byVal iStr)
if isnull(iStr) or isEmpty(iStr) then
Jencode=""
Exit function
end if
dim F,i,E
F=array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ",_
"ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ",_
"ヂ","ダ","ゾ","ゼ")
E=array("Jn0;","Jn1;","Jn2;","Jn3;","Jn4;","Jn5;","Jn6;","Jn7;","Jn8;","Jn9;","Jn10;","Jn11;","Jn12;","Jn13;","Jn14;","Jn15;","Jn16;","Jn17;","Jn18;","Jn19;","Jn20;","Jn21;","Jn22;","Jn23;","Jn24;","Jn25;")
F=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
Jencode=iStr
for i=0 to 25
Jencode=replace(Jencode,F(i),E(i))
next
End Function
解碼:
Function Juncode(byVal iStr)
if isnull(iStr) or isEmpty(iStr) then
Juncode=""
Exit function
end if
dim F,i,E
F=array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ",_
"ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ",_
"ヂ","ダ","ゾ","ゼ")
E=array("Jn0;","Jn1;","Jn2;","Jn3;","Jn4;","Jn5;","Jn6;","Jn7;","Jn8;","Jn9;","Jn10;","Jn11;","Jn12;","Jn13;","Jn14;","Jn15;","Jn16;","Jn17;","Jn18;","Jn19;","Jn20;","Jn21;","Jn22;","Jn23;","Jn24;","Jn25;")
F=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
Juncode=iStr
for i=0 to 25
Juncode=replace(Juncode,E(i),F(i))□
next
End Function
注意,如果直接使用字符不方便(windows還沒裝日文支持),注釋掉的部分提供有 chr(-23804) ..這樣的定義
本新聞共3頁(yè),當(dāng)前在第1頁(yè)
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com