This article mainly introduces the solution to ASP fuzzy query memory overflow in ACCESS. The reason for this problem is the character encoding problem. A transcoding function is used to solve it. Friends in need can refer to the following
Today, while doing daily maintenance on a website, I discovered that the website's message program did not undergo strict verification and filtering, resulting in nearly 100,000 pieces of junk data. There is a lot of important information in it, and the data needs to be cleaned and more stringent verification measures added.
However, it is not very scientific to delete directly in the database, and a lot of important information will be deleted by mistake.
Through fuzzy query statements:
Copy the code code as follows:
select * from Feedback where Comments like '%http%'
Result: "Out of memory"
After constant searching, the main cause of the problem was found:
When using the LIKE keyword to query Japanese symbols in asp, an error will occur, such as Chr(-23075), indicating a memory overflow.
If the data in the data table contains Japanese or some special non-simplified Chinese characters, memory overflow errors will also occur.
It is said online that the above problem has been confirmed by Microsoft engineers at Microsoft Power Camp and is a product BUG that cannot be solved. The only way is to encode the entire database data into ANSI text format and then save it. DECODE again when displayed.
There is no solution. The only way is to convert the field and save it to another new field as mentioned above, and then perform the cleaning operation. It is really difficult to face this excessive data.
EncodeString function performs character escaping
Copy the code code as follows:
Function EncodeString(strWords)
Dim i As Long
Dim strEncodeWords
For i = 1 To Len(strWords)
strEncodeWords = strEncodeWords & CStr(Asc(Mid(strWords, i, 1))) & ","
Next
EncodeString = strEncodeWords
End Function
After escaping in this way, during fuzzy search, escape the keywords
Copy the code code as follows:
delete * from Feedback where Comments_new like '%&EncodeString("http")&%'