Thursday, October 1, 2015

WPF OLEDB connectionstring fill datagrid

Imports System.Windows.Controls
Imports System.Data.OleDb
Imports System.Data
Imports System.Configuration



 Dim cn As New OleDbConnection
        Dim ds As New DataSet
        Dim da As New OleDbDataAdapter
        Dim dt As New DataTable
        cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=k12i07s2002s;Data Source=bochn2015.mdb")

        Dim cm As New OleDbCommand("select * from chhead", cn)
        da = New OleDbDataAdapter(cm)
        dt = New DataTable
        da.Fill(dt)
        DataGrid1.ItemsSource = dt.AsDataView