Results 1 to 4 of 4

Thread: compile error

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    compile error

    Dim cn As ADODB.Connection
    Dim adoRS As ADODB.Recordset

    keeps giving me no user defined types

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: compile error

    You need to set a reference to the Microsoft ActiveX Data Objects Library X.X (where X.X is the latest version you have on your machine. I have 2.7 but some folks have 2.8).

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: compile error

    thanks, worked.
    also..

    VB Code:
    1. Private Function SQL_Connect()
    2.     Set cn = New ADODB.Connection
    3.    
    4.     cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=<server>;PORT=3306;DATABASE=db;USER=<user>;PASSWORD=<pass>;OPTION=3;"
    5.     cn.Open
    6.    
    7.     Set adoRS = New ADODB.Recordset
    8. End Function

    i call this on form_load to connect to the database. How can i set a boolean variable to true/false depending if the connection to the databse was successful..

    this way, if im doing sql statements throughout the proggy i can check if the bool variable is true first!

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: compile error

    VB Code:
    1. If cn.State = adStateOpen Then
    VB sets the boolean for you.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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