Public Sub Connect_database()
Try
With connection
If .State = ConnectionState.Open Then .Close()
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Contacts.mdb"
.Open()
End With
Catch ex As Exception
MessageBox.Show("Not connected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Application.Exit()
End Try
End Sub
Exactly what I needed. Thanks for the nice codes you have.
ReplyDeleteIt was a problem for me to populate Listview with data.
ReplyDeleteThanks