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
        DataGrid1.ItemsSource = dt.AsDataView

Monday, April 27, 2015

VB6 copy table in between databases

//Make a connectionstring of source database (ftp.mdb)

Public Sub cnOPEN()

mdbname = "ftp.mdb"

    If cn.State = 1 Then
    End If
    cn.Mode = adModeReadWrite
    cn.Open "Provider=MSDataShape.1;Data Provider = Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & mdbname

End Sub

// copy table joborderauth from ftp.mdb to jobo in dlab.mdb

ap = App.Path & "\dlab.mdb"

cn.Execute "SELECT * INTO jobo IN '" & ap & "'FROM joborderauth"