I get this error message when trying to open my 2002 access database using MS visial Studio 2005
"System.IO.FileNotFoundException was unhandled" using the code below

Imports System.Data.OleDb
Imports System.Console
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

Source=C:\temp\MIRC\CCC_DATA.mdb;Persist Security Info=False")
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\MIRC\CCC_DATA.mdb;")

this following code to display data on datagrid.

Dim con As New OleDb.OleDbConnection
    Dim cmdOle As New OleDb.OleDbCommand
    Dim dsOle As New DataSet
    Dim da As New OleDb.OleDbDataAdapter
    Dim dtOle As New DataTable
    Dim sql As String

Private Sub LoadData()
        con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source= D:\Only Me\Authors.mdb")
            cmdOle = con.CreateCommand
            cmdOle.CommandText = "SELECT * FROM Authors "
            da.SelectCommand = cmdOle
            da.Fill(dsOle, "Authors")
            dgAuthor.DataSource = dsOle
            dgAuthor.DataMember = "Authors"
            dgAuthor.ReadOnly = True
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub

    Private Sub Search_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
This article has been dead for over six months. Start a new discussion instead.