Data | database | problem | When you perform a query for a database, you often encounter situations like this:
For exampleYou want to query his user name and his password in a user database, but it happens that the user has a special character in the name and password, such as single quotes, "|" Resolution
Double quotes or hyphen "&".
For exampleHis name is 1 ' test, and the password is a|&900.
when you execute the following query statement, you will definitely get an error:
SQL = "SELECT * from SecurityLevel WHERE uid= '" & UserID & "'"
sql = SQL & "and pwd= '" & Password & "'"
because your SQL is going to be like this:
SELECT * from SecurityLevel WHERE uid= ' 1 ' test '
and pwd= ' a|&900 '
in sql, the "|" For the Split field, it's obviously going to go wrong. Now provide a few of the following functions specifically for dealing with these headaches:
Function replacestr (Textin, ByVal searchstr as String, _
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.