Results 1 to 5 of 5

Thread: SQL connection (easy)

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    Virginia
    Posts
    55

    Unhappy SQL connection (easy)

    Everybody seems to use connections like this for SQL Server:

    <code>
    dim objCN as ADODB.Connection
    set objCN = new ADODB.Connection

    objCN.Open "Provider=SQLOLEDB;Data Source=Server Name;UID=UserName;PWD=Password;Database=MyDatabase"
    </code>

    When I try to run it, I get an user-defined type not defined error. I think I just need to add the right component to my project, but don't know which one. Please help. Thank you all.
    Thanks,
    Chris

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    You need to add a reference to Microsoft ActiveX Data Objects 2.x to your VB project.

    Hope this helps

    S@NSIS
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    Virginia
    Posts
    55

    Ummm...

    What if that's not an option in my list of components?
    Thanks,
    Chris

  4. #4
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    It won't be in your list of components it will be in your list of references (just above components in the menu).
    If it isn't in there you will need to download the latest MDAC from the Microsoft site (currently version 2.6)

    Hope this helps

    S@NSIS
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    Virginia
    Posts
    55

    Never Mind

    I was looking in components instead of references. You are the man and deserve great rewards of sweet foods and plump women.
    Thanks,
    Chris

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