[Solved] Error .accdb access file added in vb.net Error Name : unrecognized database format .accdb
[Solved] Error .accdb access file added in vb.net Error Name : unrecognized database format .accdb
In access old version file extension is .mdb and new version is .accdb
In Visual Basic .mdb file add successfully no error will occur but .accdb file have error that
unrecognized database format .accdb.
so first you need to download AccessDatabaseEngine than install it and restart your computer.
ConnectionString = "Provider=xyz;Data Source=YourDataBase"
for .mdb we use Provider=Microsoft.Jet.OLEDB.4.0;
and for .accdb we use Provider=Microsoft.ACE.OLEDB.12.0;
Example for Access database Connectivity
Private conn As New OleDbConnection
Private cmd As New OleDbCommand
Private DR As OleDbDataReader
Private DT As New DataTable
Private path As String = "C:\Database.accdb"
'Put this code where you want to fetch the data
Try
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & path & "'"
cmd.Connection = conn
cmd.CommandText = "Select * from TableName"
conn.Open()
DR = cmd.ExecuteReader
DT.Load(DR)
'feedTable is GridView in vb.net
FeedTable.DataSource = DT
conn.Close()
Catch ex As Exception
conn.Close()
MsgBox("Error : " & ex.Message)
End Try
Thank You Give your Comments for help others.