Results 1 to 9 of 9

Thread: Using ADO to create a database (solved)

  1. #1
    DerFarm
    Guest

    Using ADO to create a database (solved)

    I give up. I've looked for 2 hours now,

    how do you create a new database (not a table) in ADO?


    also, how do I delete this thread because my stupid *($#&*#$& is so slow I hit the submit button twice?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    What database type are you trying to create?? Access, SQL Server, Oracle, Sybase ?

  3. #3
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    St. Albans, Herts, UK
    Posts
    259
    Use ADOX
    VB Code:
    1. Dim catADO    As ADOX.Catalog
    2.  
    3. catADO.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TestDatabase.mdb"
    for details see my site...
    Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
    www.gab2001uk.com For comparing and contrasting DAO with ADO
    Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek

  4. #4
    DerFarm
    Guest
    Only works when the string is explicit:


    Code:
    Dim catADO As ADOX.Catalog
    Dim str_Temp As String
    
    Set catADO = New ADOX.Catalog
    catADO.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\xsxx.mdb"

    works fine, but

    Code:
    Dim catADO As ADOX.Catalog
    Dim str_Temp As String
    
    Set catADO = New ADOX.Catalog
    str_Temp = "Provider=Microsft.Jet.OLEDB.4.0;Data Source=c:\xsxx.mdb"  
    
    catADO.Create (str_Temp)
    gets an error: Class not registered

    Any ideas?

  5. #5
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    St. Albans, Herts, UK
    Posts
    259
    If it is just the name of the new db you want to change then
    VB Code:
    1. Dim catADO As ADOX.Catalog
    2. Dim str_Temp As String
    3.  
    4. Set catADO = New ADOX.Catalog
    5. str_Temp = "c:\xsxx.mdb"  
    6.  
    7. catADO.Create "Provider=Microsft.Jet.OLEDB.4.0;Data Source=" & str_Temp
    Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
    www.gab2001uk.com For comparing and contrasting DAO with ADO
    Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek

  6. #6
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    Or see your chit chat thread!
    I answered it there!
    later
    b

  7. #7
    DerFarm
    Guest
    I'm an idiot.
    I'm dumber than snails.
    I talk to squirrels.
    I can't spell MICROSOFT.

    That's the error in the above. The word Microsoft in the connection string is spelled MICROSFT.

    damn machines.

  8. #8
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    St. Albans, Herts, UK
    Posts
    259
    Oh dear...

    Perhaps we should have looked at the obvious first.
    Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
    www.gab2001uk.com For comparing and contrasting DAO with ADO
    Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek

  9. #9
    DerFarm
    Guest
    We did Gab. It's just that looking for your own errors in spelling is difficult under the best of circumstances. That's why a good editor is more precious than a good author.

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