ASP code implementation tips for automatically clearing Japanese characters that replace an access (MDB) database

Source: Internet
Author: User
At this point we usually think of the idea is to find an EXE program, to solve the problem out. I used to write such a similar program in C #.
Google should be able to find the one I wrote before. I will not say it.
Then one day, I found that the ASP can be implemented. I really felt like I was in a lot of crap.
But this method of ASP is very bad. Easy to cause system crashes (if the database is large).
So just write it here. is a kind of a trigger.

' Let me explain the following:
Function transferjapandc9cnindb ()

On Error Resume Next
Err.Clear
Dim Objrs,i
Set objrs=server.createobject ("ADODB. Recordset ")
Objrs.cursortype = adOpenKeyset
Objrs.locktype = adLockReadOnly
Objrs.activeconnection=objconn
Objrs.source= "SELECT * from [Blog_comment]"
Objrs.open ()

If (not Objrs.bof) and (not objrs.eof) Then

For I=1 to Objrs.recordcount
' Traversal, to see if there is any Japanese, if there is, overflow, random search for a thing on the line. It doesn't matter what you search. Because it's traversing access, it overflows as soon as the pointer moves to Japanese.
objConn.Execute ("select * from [blog_comment] WHERE comm_id=" &objrs ("comm_id") & "and [comm_content] like '%url% '")
If err.number=-2147217900 Then
' Because it's on err, so here we find the overflow error code, which is debug out of you, and it's not actually from where you're looking.
objConn.Execute ("UPDATE [blog_comment] SET [comm_content]= '" &filtersql (japan2html ("objRS")) & "', [comm_author]= '" &filtersql (japan2dc9cnhtml (objRS ("Comm_author"))) & "WHERE comm_id=" &objrs (" comm_id ") &" ")
This is to replace the Japanese, the idea is not very clever. Well. But the database is huge, repeatedly overflow will be very problematic. The memory baby will cry.
Err.Clear
End If
Objrs.movenext
Next

End If

Objrs.close
Set objrs=nothing
' Www.dc9.cn 07/11/28
End Function








Function japan2dc9cnhtml (source)
Source=replace (source, "ガ", "ガ")
Source=replace (source, "hygiene", "hygiene")
Source=replace (source, "ア", "ア")
Source=replace (source, "ゲ", "ゲ")
Source=replace (source, "ゴ", "ゴ")
Source=replace (source, "ザ", "ザ")
Source=replace (source, "ジ", "ジ")
Source=replace (source, "ズ", "ズ")
Source=replace (source, "ゼ", "ゼ")
Source=replace (source, "ゾ", "ゾ")
Source=replace (source, "ダ", "ダ")
Source=replace (source, "ヂ", "ヂ")
Source=replace (source, "Β访ヅ概", "Β访ヅ概")
Source=replace (source, "デ", "デ")
Source=replace (source, "ド", "ド")
Source=replace (source, "バ", "バ")
Source=replace (source, "パ", "パ")
Source=replace (source, "ビ", "ビ")
Source=replace (source, "ピ", "ピ")
Source=replace (source, "ブ", "ブ")
Source=replace (source, "ブ", "ブ")
Source=replace (source, "プ", "プ")
Source=replace (source, "ベ", "ベ")
Source=replace (source, "ペ", "ペ")
Source=replace (source, "ボ", "ボ")
Source=replace (source, "ポ", "ポ")
Source=replace (source, "ヴ", "ヴ")
Japan2html=source
End Function

By the way, my blog has been repeatedly hack, making me very depressed, because it is Arab or Israeli people do, so can not communicate.
I can't find out how they did it.
It's really depressing.
All right.
In the days that followed. I will post some technical articles again. Suddenly feel this seat is very valuable to say.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.