Results 1 to 3 of 3

Thread: a Techie Question

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Question 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?

    abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    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
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    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.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width