-
a Techie Question
Hi there,
What is the difference between the following object declaration statements?
Dim cn as New Adodb.Connection
Dim cn as Adodb.Connection
Dim cn as object
Set cn = CreateObject("Adodb.Connection")
I mean to ask what happens internally in visual basic?
:rolleyes: abhijit :confused:
-
as far as I understand.
the first two:
Dim cn as New Adodb.Connection
Dim cn as Adodb.Connection
are Know as early binding..you creating the object AS the connection. Supposedly Faster.
This is LATE binding...The Object is Created then VB is told what the object is..Slowr..especially over a network
Dim cn as object
Set cn = CreateObject("Adodb.Connection")
Any deeper expanation...will have to come from someone else :rolleyes:
-
Dim cn as New Adodb.Connection
Memory Alloated for varible cn. cn is declared as a ADODB.CONNECTION
Dim cn as Adodb.Connection
Memory is NOT allocated for cn. You must first use the set or for each statements.
Dim cn as object
Set cn = CreateObject("Adodb.Connection")
Dims cn as an object (very general) and then sets the object as a new ADODB.CONNECTION. The property list won't appear.