I am trying to build a windows application with Visual Basic 2008 using vb.net that will connect and read from and insert new records into an access 2007 database. I have searched several sites and cannot find any clear reference on how to do this. I will post the code I have so far below. Please fix my code or give me a new example of a better way to do this.
I am only getting one error right now and that is on the third line in my code:
"Dim dbreader As New OleDb.OleDbDataReader"
The error I am getting is:
taReader' has no constructors."
Thanks in advance for your help.
Dim dbcon As New OleDb.OleDbConnection
Dim dbcomm As New OleDb.OleDbCommand
Dim dbreader As New OleDb.OleDbDataReader
Dim dbProvider As String
Dim dblookupString As String
dbProvider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\database.accdb;Persist Security Info=False;"
dbcon.ConnectionString = dbProvider
dblookupString = "Select * from tblinventory where ItemBarcode = " & textAddItem.Text
dbcomm.Connection = dbcon
dbcomm.CommandText = dblookupString
dbreader = dbcomm.ExecuteReader()
MsgBox(dbreader("ItemName")) 'Show data in a Message Box