ASP code to automatically clear and replace the Japanese characters of the ACCESS (MDB) Database

Source: Internet
Author: User

In this case, we usually think of finding an exe program to solve this problem. I used to write such a similar program in C.
Google should be able to find the one I previously wrote. Let's not talk about it.
One day later, I found ASP could be implemented. At that time, I really felt so stupid.
However, this method of ASP is not good. It is easy to cause system crash (if the database is large ).
So I just wrote it here. It can be regarded as a reference.

'Next I will 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
'Traverse to see if there is any Japanese. If there is any, it will overflow. Just search for something. It doesn't matter what you search. This is because the traversal of ACCESS overflows as long as the pointer is moved to Japanese.
ObjConn. Execute ("SELECT * FROM [blog_Comment] WHERE comm_ID =" & objRS ("comm_ID") & "AND [comm_Content] LIKE '% URL % '")
If Err. Number =-2147217900 Then
'The overflow error code is found here because it is on err. This is self-debug, and it is not actually found from somewhere.
ObjConn. execute ("UPDATE [blog_Comment] SET [comm_Content] = '" & FilterSQL (Japan 2html (objRS ("comm_Content ")))&"', [comm_Author] = '"& FilterSQL (Japan2Dc9CnHtml (objRS (" comm_Author ") &" 'where comm_ID = "& objRS (" comm_ID ")&"")
'This is to replace Japanese. Is the idea clever. Well. However, if the database is huge, repeated overflow may cause problems. Memory babies 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, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Source = Replace (source, "success", "success ")
Japan2Html = source
End Function

By the way, my blog has been repeatedly hack recently, which makes me very depressed. It is impossible to communicate because it was done by the Arab or Israeli.
I still cannot find out how they did it.
It's really depressing.
Okay.
In the following days. I will post some more technical articles. I suddenly felt that this seat was very valuable.

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.