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
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.
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.