Imports System.Data.OleDb
Public Class Lotti
Dim Connex As New ConnessioneDB
Dim Comando As New OleDbCommand
Dim Adatta As New OleDbDataAdapter()
Dim Tabella As New DataTable()
Dim Nome_Tabella As String = "Ditte1"
Dim Data As Integer
Dim Reader As OleDbDataReader
Private Sub ShowData()
Try
Connex.openConnection()
Catch ex As Exception
MessageBox.Show("Connection failed !!!" & vbCrLf & "Please check that the server is ready !!!", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End Try
Try
Comando.CommandType = CommandType.Text
Comando.CommandText = "SELECT * FROM " & Nome_Tabella & ""
Comando = New OleDbCommand(Comando.CommandText, Connex.getConnection)
Reader = Comando.ExecuteReader
While Reader.Read
Dim sName = Reader.GetString("Società")
ComboBox1.Items.Add(sName)
End While
Catch ex As Exception
MsgBox("Failed to load Database !!!" & vbCr & ex.Message, MsgBoxStyle.Critical, "Error Message")
Connex.closeConnection()
Return
End Try
Connex.closeConnection()
End Sub