I'm trying to pick up ADO.NET and VB.NET again, but I'm getting an error when I try to execute a piece of code I've written I get the error "Connection has not been initialised"
the line of code visual studio gives the error on is:
VB.NET:
Dim strValue As String
Dim cnnDatabase As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Tim\Documents\F1TB\F1TB\F1TB.accdb")
Dim ocmdCommand As New OleDb.OleDbCommand
Dim dtrDataReader As OleDb.OleDbDataReader
ocmdCommand.CommandText = "SELECT Team FROM tblTeam"
cnnDatabase.Open()
dtrDataReader = ocmdCommand.ExecuteReader
strValue = dtrDataReader.Item("Team")
dtrDataReader.Close()
cnnDatabase.Close()
the line of code visual studio gives the error on is:
VB.NET:
dtrDataReader = ocmdCommand.ExecuteReader