Recommended: How to obtain the user's real IP address asp General programs have the command to obtain the user's IP address, but there are two types of websites we visit, one is an ordinary user like us, and the other is a user who uses a proxy IP to surf the Internet. I will introduce it below. The easiest way to get the user's IP address in asp is to use it, but if the user uses the proxy server IP address, it is wrong, but we can use the above results
In ASP, we often use two parameters, isNull and isEmpty, which are used when we judge that a certain string is empty. For example, if a string is str1, we often use if isNull(str1) or isEmpty(str1) then to judge, or use if str1=// then to judge whether the string is empty.
Sometimes we are very confused. What is the difference between isNull, isEmpty and empty strings?
isNull()
The Null value indicates that the variable does not contain valid data. Null is different from Empty, which states that the variable is not initialized. Null is also different from zero-length string(), which often refers to empty strings.
Focus on using the IsNull function to determine whether an expression contains a Null value. In some cases, you want to take the expression value True, such as IfVar=Null and IfVar<>Null, but they are usually always False. This is because any expression containing Null is Null itself, so the result of the expression is False.
Example 1
The following example uses the IsNull function to determine whether a variable contains Null:
If the variable is not initialized or explicitly set to Empty, the function IsEmpty returns True; otherwise the function returns False. If exPRession contains more than one variable, False will always be returned.
The following example uses the IsEmpty function to determine whether a variable can be initialized:
3. Zero-length string()
Zero-length strings often refer to empty strings.
str=, assign an empty string to the str variable, has been assigned a value, and the character assigned is
The difference between the three is:
isnull is a type test that tests whether it is a null value.
isEmpty is a value test that tests whether it is a null value. But the methods used in different languages are different.
= is a string test, test whether the value is a null value.
Let's talk about isEmpty. In some languages isEmpty is a null value test, which can test the following content:
That is, in some languages, the 0 in the data, the empty string in the character, and the NULL values are all used as the test scope of null values.
However, the requirements in languages such as C# are relatively strict, and the requirements in VB are not very strict. Here, as long as you understand a special type null type, its class is of course null. At the same time, there is an undefined type in some languages:
undefined type, as in C#:
string str ;
Then string only has this one definition, so its value has not been truly defined yet, and at this time it is of type undefined. This type often exists in C-language languages and C-language classes such as ECMAScript family (javascript, etc.) and Java!
Supplement: In the database design, a certain field can be specified as null, so that if no value is assigned to it, this record is null, but when the table is output, the null record will destroy the structure of the table, that is, the grid lines in the table will disappear. Many people will set a default value in the database or assign an empty string to this record during processing when this situation may occur.
Share: Asp connection to SQLServer database implementation code This article introduces the code of using asp to connect to SQLServer database instance. There are three connection methods: establishing a connection through ODBC DSN and establishing a connection through oledb and establishing a connection through driver. Let’s take a look at the first one. Establish a connection through driver Establish a connection through driver Establish a connection through driver Establish a page and database connection through driver, and there is no need to create an ODBC DSN