---------------------------- Explanations from the Internet ---------------------------------
Dim is used to define a variable. set is used to specify an object for a variable. It can also be understood as assigning values to the object variable.
For example, dim
In fact, vbscript can be used directly without definition.
A = 10
Dim conn
Set conn = server. createobject ("adodb. connection ")
Set cannot be omitted.
------------------------------ Self-understanding content ---------------------------------
ASP language, Option Explict forced definition of variables (good programming habits, it is best to enable)
① Define variables → ② assign values to variables
Dim a, conn' two variables are defined here, where we define a as a non-object variable (variable type), while conn is an object variable (variable type)
A = "This is the test !!! "'We assign a value to this variable. It is a string variable and does not use the set statement because it is not an object variable.
Set conn = server. createobject ("adodb. connection") 'We must use the set statement when assigning values to this object variable.
DIM is generally used to declare variables, such as dim variable name as data type.
SET is generally used to assign values to some special data types, such as those written by the above side, because the = Sign alone cannot assign values. Generally, you must use set to assign values to connection command recordset.