[OleDB] Verwendung eines DataGridView

Dim sConnectionString
Dim sSQL As String

sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mydatabase.mdb"
sSQL = "SELECT ID, Name FROM Person"

Dim DB_Conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim DB_DataAdapter As New System.Data.OleDb.OleDbDataAdapter(sSQL, DB_Conn)
Dim DataSet As New DataSet()

DB_Conn.Open()
DB_DataAdapter.Fill(DataSet, "Person")

dgvConsumptionData.DataSource = DataSet.Tables("Person")

DB_Conn.Close()

Schreibe einen Kommentar