Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • 1 month later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...