joe_pool_is Posted November 14, 2005 Posted November 14, 2005 Could someone point out how to create an Access database with ADO? Microsoft has an article mentioning that CREATEDB allows a user to create a new database (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acadvsql.asp), but it does not show how to use it. I like being able to use a database with my program, but if some bozo deletes it, the whole program becomes useless. Quote Avoid Sears Home Improvement
macdonab Posted December 16, 2005 Posted December 16, 2005 Create Access Db Try something like this; Private Sub CreateDatabase(ByVal DBName As String) Dim Cat As Catalog = New Catalog Try Cat.Create("Provider=Microsoft.Jet.OLEDb.4.0;" & _ "Data Source=" & _ DBName & ";" & _ "Jet OLEDb:Engine Type=5") 'Access Database Versions; ' Type 5 - Access 2000 Catch ex As OleDbException MessageBox.Show(ex.Message, _ "OLEDb Error", _ MessageBoxButtons.OK, _ MessageBoxIcon.Exclamation) Catch ex As Exception MessageBox.Show(ex.Message, _ "VB.Net Error", _ MessageBoxButtons.OK, _ MessageBoxIcon.Exclamation) Finally Cat = Nothing End Try End Sub Quote
joe_pool_is Posted December 16, 2005 Author Posted December 16, 2005 Thanks macdonab, that turns out to be exactly what I used. Still, it seems strange that Microsoft would point out the command CREATEDB and tell what it does without actually having a way to use it. Quote Avoid Sears Home Improvement
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.