My program will not build due to an error related to the section of code below shown inbetween the following symbol.
The error which i recieve is the following:
Object reference not set to an instance of an object.
any help would be appreciated, thanks again
Imports System.Data
Public Class Navigation
Dim inc As Integer
Dim maxrows As Integer
Dim con As OleDb.OleDbConnection
Dim ds As DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub Navigation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
~~~~~~~~~~~~~~~~~~~~~~~~
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=""C:\AddressBook.mdb"";"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
con.Open()
MsgBox("A Connection to the Database is now open")
sql = "SELECT * FROM tblContacts"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")
con.Close()
MsgBox("The Connection to the Database is now Closed")
maxrows = ds.Tables("Address Book").Rows.Count
MsgBox("Rows.count")
inc = -1
End Sub
End Class