Automatically clear ASP code that replaces the Japanese characters of the ACCESS (MDB) Database

Source: Internet
Author: User
We all know that access is a close partner of asp. Because the two simplest things can always spark together. However, when the filtering is not strict, the Japanese characters are often displayed. After searching, the Japanese character overflows. In this case, we usually think of finding an exe program to solve this problem. I used to write this in C #.

We all know that access is a close partner of asp. Because the two simplest things can always spark together. However, when the filtering is not strict, the Japanese characters are often displayed. After searching, the Japanese character overflows. In this case, we usually think of finding an exe program to solve this problem. I used to write this in C #.

We all know that access is a close partner of asp. Because the two simplest things can always spark together.
However, when we do not strictly filter dataJapaneseCharacter.JapaneseOverflow.
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 (ifDatabaseLarge ).
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 anyJapaneseIf yes, it will overflow. You can simply search for something. It doesn't matter what you search. Because it is traversing ACCESS, as long as the pointer movesJapaneseOverflow.
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 is found here because it is on err.CodeThis is self-debug, but it is not from any place.
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 ")&"")
'JapaneseReplaceIs the idea clever. Well. HoweverDatabaseIf it is too large, repeated overflow will cause problems. Memory babies will cry.
Err. Clear
End If
ObjRS. MoveNext
Next

End If

ObjRS. Close
Set objRS = Nothing
'Www .dc9.cn http://www.devdao.com/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

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.