CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Which is the right reference for a Database object?

    I want to set an object as Database:

    Dim db as Database



    Which is the Refernce that I must set in order to satisfy this?

    Michael Vlastos
    Automation Engineer
    Company SouthGate Hellas SA
    Development Department
    Athens, Greece

  2. #2
    Join Date
    Aug 1999
    Location
    India-Delhi
    Posts
    106

    Re: Which is the right reference for a Database object?

    Hi,

    Please check on Microsoft DAO 3.51 Object Library.



    Santulan

  3. #3
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Which is the right reference for a Database object?

    I already use ADO 2.0. Doesn't it support it? Am I enforced to use DAO?

    Michael Vlastos
    Automation Engineer
    Company SouthGate Hellas SA
    Development Department
    Athens, Greece

  4. #4
    Join Date
    Aug 1999
    Location
    India-Delhi
    Posts
    106

    Re: Which is the right reference for a Database object?

    Well, I have not used ADO so far but to use database I always use DAO.

    I just think that with ADO you use ADODB or Connection.




    Santulan

  5. #5
    Join Date
    Oct 1999
    Location
    Florida
    Posts
    36

    Re: Which is the right reference for a Database object?

    I have been useing this approach, but if you have a better one let me know..

    Database SQL 6.5


    '//
    PROVIDERTIMEOUT=100 ' Really slow app.
    ADOProvider = "SQLOLEDB"


    DB_ENV = ";Server=" & DSNAME & ";Uid=" & DSN_UID & ";Pwd=" & DSN_PWD & ";Database=" & DSN_DB
    OBWebDB.CommandTimeout = PROVIDERTIMEOUT
    OBWebDB.Provider = ADOProvider
    OBWebDB.Open DB_ENV


    whg

  6. #6
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Re: Which is the right reference for a Database object?

    Better solution: Data Environment -> Visual and easy!

    Michael Vlastos
    Automation Engineer
    Company SouthGate Hellas SA
    Development Department
    Athens, Greece

  7. #7
    Join Date
    Dec 1999
    Location
    Detroit, MI 48233
    Posts
    1

    Re: Which is the right reference for a Database object?

    To use a Database object you must first make a reference to DAO. Go to Project, References, Microsoft DAO x.x Object Library. After making this reference, you can then Dim a variable as a database object.


  8. #8
    Guest

    Re: Which is the right reference for a Database object?

    Use the following code to set a reference to a database object:

    Sub CreateDatabaseX()

    Dim wrkDefault As Workspace
    Dim dbsNew As DATABASE
    Dim prpLoop As Property

    ' Get default Workspace.
    Set wrkDefault = DBEngine.Workspaces(0)

    ' Make sure there isn't already a file with the name of
    ' the new database.
    If Dir("NewDB.mdb") <> "" Then Kill "NewDB.mdb"

    ' Create a new encrypted database with the specified
    ' collating order.
    Set dbsNew = wrkDefault.CreateDatabase("NewDB.mdb", _
    dbLangGeneral, dbEncrypt)

    End Sub


  9. #9
    Join Date
    Jul 1999
    Location
    Athens, Hellas
    Posts
    769

    Ok thanx!

    Finally you have right, but I don't want to use DAO. I thought database object was supported by ADO that I use. I have no experience with DAO...
    Thanx man for your help, and all the others of course!

    Michael Vlastos
    Automation Engineer
    Company SouthGate Hellas SA
    Development Department
    Athens, Greece

  10. #10
    Join Date
    Dec 1999
    Posts
    5

    Re: Which is the right reference for a Database object?

    If you want to programmatically change the Data Environment database, use something like this:

    deObject.YourConnection.Open "PROVIDER=xyz;Data Source=filename.abc"

    Francis Gingras


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

Featured