Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a database using ADO and VB? 2

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
0
0
DK
Is it possible to create a database using ADO and VB?
All the examples I can find uses Access to create the database and then accesses the database from VB using ADO.

Using DAO the database can be created by Set dbs = CreateDatabase. But how to do it by ADO?

If you know please write back, Thanks
Sunaj


 
Sub ADOCreateDatabase ()

Dim cat As New.Catalog

cet.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source = c:\new.mdb;"

End Sub

Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Hi Eric

Thanks for your answer. It did, however, not help me.

Catalog is not a known identifier. Does this require a reference other than the microsoft ActiveX Data Objects 2.0 Libary?

I assume that the dot between 'new' and catalog is not supposed to be there(?), and that it also should be cat.create (and not cet.create).

If your could clarify I would be glad, thanks
 
There's no type called 'Catalog' in ADO 2.5

Does your code work for you?
 
Put a reference to MS ADO Ext. 2.6 for DDL and Sequrity and try the following code:
Code:
Private Sub Form_Load()
    Dim oCat As New ADOX.Catalog
    Dim strCon As String
    
    strCon = oCat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source = c:\new.mdb;")
    MsgBox strCon
    
End Sub

Good Luck
-Mats
 
Bingo.
That's what I needed. Thanks Mats :->

Sunaj
 
Speaking of different versions of ADO, at the msdn website for ADO would downloading and installing MDAC 2.6 Software Developers Kit be the way to get the newest one? I can't seem to find anything there simply called ADO x.x.
 
MDAC 2.6 is the latest version of the components.
Be sure that you download support for MS Jet separately, as MS for some reason has decided to separate Access from MDAC.

Cant give you any links though.

Good Luck
-Mats
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top