2 Replies - 13546 Views - Last Post: 06 April 2011 - 01:33 PM Rate Topic: **--- 1 Votes

#1 Jupiter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 01-February 07

Database Connection - MS Access 2007 with VB.NET (Unrecognized..)

Posted 06 April 2011 - 01:03 PM

hello

im trying to connect a form with a database, MS Access 2007, and i'm getting an error :(
My code are as follows:
Public Class Form1

    Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click

        'The Connection Object
        'variable con will hold the Connection Object
        Dim con As New OleDb.OleDbConnection

        'Setting a Connection String
        Dim dbProvider As String 
        Dim dbSource As String 

        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = C:\Users\Neelesh\Documents\Visual Studio 2008\Projects\TestPlatform\mmc.accdb"

        con.ConnectionString = dbProvider & dbSource

        con.Open() 'Open method of the Connection Object
        MsgBox("Database is now open")

        con.Close() 'Close method of the Connection Object
        MsgBox("Database is now Closed")

    End Sub
End Class

The error that i'm getting (con.Open()is being highlighted)

Quote

Unrecognized database format 'C:\Users\Neelesh\Documents\Visual Studio 2008\Projects\TestPlatform\mmc.accdb'.


i have tried to google the problem, i.e

1. Changing PROVIDER=Microsoft.Jet.OLEDB.4.0 to PROVIDER=Microsoft.Jet.OLEDB.12.0;, same error
2. I have also changed my database extension name [saved as] from 2007(.accdb) to 2003(.mdb), same error

Im using VS 2008 Ex.Ed and MS Access 2007
If you have any idea whats going wrong about this code, pls help, thx ;)

Is This A Good Question/Topic? 0
  • +

Replies To: Database Connection - MS Access 2007 with VB.NET (Unrecognized..)

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,462
  • Joined: 12-June 08

Re: Database Connection - MS Access 2007 with VB.NET (Unrecognized..)

Posted 06 April 2011 - 01:14 PM

Oh ho ho! Someone didn't check connection strings.com!

http://www.connectio...com/access-2007

About Office 2007 or so they moved from 'jet' to 'ace'. Check it out and it should work like a peach.
Was This Post Helpful? 1
  • +
  • -

#3 Jupiter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 01-February 07

Re: Database Connection - MS Access 2007 with VB.NET (Unrecognized..)

Posted 06 April 2011 - 01:33 PM

:blush: lol, thx its working! ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1