dim is used to define a variable, and set is used to specify an object for a variable. This is the explanation on the Internet. Next, I will introduce my own understanding. Friends who are interested can refer to it. I hope it can help you-- --------------------------Explanation from the Internet-------------------- -------------
dim is used to define a variable, and set is used to specify an object for a variable, which can also be understood as assigning a value to an object variable.
Such as dim a
In fact, you can use it directly in vbscript without defining it.
a=10
dim conn
set conn=server.createobject(adodb.connection)
set cannot be omitted.
--------------------------------What you understand---------------- ------------------
ASP language, Option Explict forces definition of variables (good programming habits, it is best to turn it on)
①Define variables→②Assign variables
Copy the code code as follows:
Dim a, conn 'Two variables are defined here, where we define a as a non-object variable (variable type), and conn as an object variable (variable type)
a = This is the test!!! 'We assign a value to this variable. It is a string variable without a set statement because it is not an object variable.
set conn=server.createobject(adodb.connection) 'When we assign a value to this object variable, we must use the set statement.
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, as written above, because assignment cannot be achieved simply using the = sign. Generally speaking, connection command, recordset, etc. must be assigned using set.