Public Class Form1 'Dim dbProvider As String = "Provider=Microsoft.ace.oledb.12.0;" 'Dim dbSource As String = "Data Source=~\bin\Debug\EC_Database_2.accdb" 'Dim constr As String = dbProvider & dbSource Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.Environment.CurrentDirectory & "\EC_Database.mdb") Dim mstr As String = "" Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try conn.Open() mstr = "Select person_ref from QN_Person_Mast order by person_ref asc" Dim sda1 As OleDbDataAdapter = New OleDbDataAdapter(mstr, conn) Dim dt1 As DataTable = New DataTable() sda1.Fill(dt1) If dt1.Rows.Count > 0 Then ComboBox1.Items.Clear() For i As Integer = 0 To dt1.Rows.Count - 1 ComboBox1.Items.Add(dt1.Rows(i)("person_ref")) Next End If conn.Close() Catch ex As Exception MsgBox(ex.Message) End Try End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)