Recommended: ASP instance: Access is a website statistics system for backend database An example of statistical production that can number visitors, record number of visits, IP, and time. I take the ACCESS library as an example. In fact, using the SQL SERVER library, you can just change the statements of the link library. The library structure is as follows: CONT.ASP was originally CONT.
Sometimes we need to query all records that have no value in a certain field. Should we use rs(xx)= or IsNull(rs(xx))? To draw a conclusion, we have to start from the beginning: Under what circumstances will there be no value in the field? Because this is closely related to our conclusion.1. What causes no value in the field?
Let's create a table to test it. There are only two fields in the table id (auto number) and aa (text):
1. Set the aa field allow empty string attribute to No, test result
rs(aa) = mzwu.com ---> Added successfully
rs(aa) = --> Field 't8.aa' cannot be a zero-length string.
rs(aa)=Empty ---> Added successfully
rs(aa) = Null ---> Added successfully
2. Set the aa field allow empty string attribute to Yes, test results
rs(aa) = mzwu.com ---> Added successfully
rs(aa) = --> Added successfully
rs(aa)=Empty ---> Added successfully
rs(aa) = Null ---> Added successfully
After the above test, the table records in the database are as follows:
From the above test results, it is not difficult to conclude that the field has no value, which may be one of the following four situations:
● rs(aa) =
● rs(aa)=Empty
● rs(aa) = Null
● When multiple fields exist in the table, some fields add values, and some fields are not added, and fields have no values.
2. rs(aa)= or IsEmpty(rs(aa)) or IsNull(rs(aa))
For the four situations in the conclusion of the first section, we test their values with rs(aa)= , IsEmpty(rs(aa)) and IsNull(rs(aa)) respectively, and we get the results:
1. Test rs(aa) =
rs(aa)= 'Result True
IsEmpty(rs(aa)) 'Result False
IsNull(rs(aa)) 'Result False
2. Test rs(aa)=Empty
rs(aa)= 'Result-
IsEmpty(rs(aa)) 'Result False
IsNull(rs(aa)) 'Result True
3. Test rs(aa)=Null
rs(aa)= 'Result-
IsEmpty(rs(aa)) 'Result False
IsNull(rs(aa)) 'Result True
4. Test fields with no added value
rs(aa)= 'Result-
IsEmpty(rs(aa)) 'Result False
IsNull(rs(aa)) 'Result True
OK, now we are not difficult to draw a conclusion:
When using rs(xx) = to add field values, we apply rs(xx)= to determine whether it has no value;
When using rs(aa)=Null or rs(aa)=Empty to add a field value or not add a value to a field, we use IsNull(rs(xx)) to determine whether it has no value;
Therefore, in order to get accurate results, when you want to query all records that have no value in the field, you should use: rs(xx)= or IsNull(rs(xx))
2007-09-14: For fields without values, rs(xx)&= results are True, which has nothing to do with the addition method. Therefore, you can use rs(xx)&= instead of rs(xx)= or IsNull(rs(xx ))
Original text: http://www.mzwu.com/article.asp?id=1071
Share: See dynamic web lovers: Asp function filtering HTML Asp filtering Html code is the following referenced content: Function RemoveHTML(strHTML) Dim objRegExp, Match, Matches Set objRegExp = New Regexp obj