1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
charge()
End Sub
Private Sub charge()
Try
Dim MyConnexion As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=c:\message")
Dim Mycommand1 As OleDbCommand = MyConnexion.CreateCommand()
Mycommand1.CommandText = "SELECT numero FROM reception"
MyConnexion.Open()
Dim myReader1 As OleDbDataReader = Mycommand1.ExecuteReader()
Do While myReader1.Read()
ListBox1.Items.Add(myReader1.GetString(0))
Loop
myReader1.Close()
MyConnexion.Close()
Catch ex As Exception
End Try
End Sub
End Class |
Partager