I am totally new to vb.net, still I am planning to try it for a project, in which there will be standalone machine using an access database to query and update different tables.
While in VB6 I was able to define recordsets using Microsoft.jet.oledb.4.0, in VB.net I have become a little confused.
I plan to define a global connection to the access database:
Dim TheConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=|DataDirectory|\office.mdb;Persist Security Info=True;Jet OLEDB:Database Password=1234")
Depending on what the user has selected, a sql command is created, e.g.
Dim SQL_CUSTOMERS As OleDbCommand = New OleDbCommand("SELECT * FROM CUSTOMERS;", TheConnection)
A list of customers can be filled as follows:
Try TheConnection.Open() Dim reader As OleDbDataReader reader = SQL_CUSTOMERS.ExecuteReader() Do While reader.Read() lst_kunden.Items.Add(reader.Item("COMPANY")) Loop reader.Close() TheConnection.Close() Catch ex As Exception MsgBox(ex.Message) End Try
The question is:
I want to display a MsgBox if there are no data available. Also is there a way to define recordsets?
I appreciate your help.