I get stuck to write an update, insert and delete command, i am looking for
some help to start
Whats the best way to update 2 tables toe the database (Access)
below my code used to load my data.(2 tables)
Do someone has a good sample code to help me?
Many thanks in advance,
Marc.
'************be gin code*********** ****
Imports System
Imports System.Data
Imports system.Data.ole db
Public Class frmPostcodesTyp edDS
Inherits System.Windows. Forms.Form
Dim strPath As String = "C:\AADatabases \BeActionData.m db"
Dim strCnBeActionDa ta As String = "provider=micro soft.jet.oledb. 4.0;
Data Source=" & strPath
Dim daActionData As OleDbDataAdapte r
'Dim mydtPostcodes As dtPostcodes = New dtPostcodes()
Dim cnBeActionData As New OleDbConnection (strCnBeActionD ata)
Dim dsLandenPostcod es As New DataSet
Dim da1 As New OleDbDataAdapte r
Dim da2 As New OleDbDataAdapte r
Dim dt1 As New DataTable
Dim dt2 As New DataTable
Private Sub frmPostcodes_Lo ad(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Call LoadPostcodes()
End Sub
Sub LoadPostcodes()
' Dim dsLandenPostcod es As New DataSet
Dim dt1 As New DataTable
Dim dt2 As New DataTable
dsLandenPostcod es.Tables.Add(d t1)
dsLandenPostcod es.Tables.Add(d t2)
Dim da1 As New OleDbDataAdapte r("Select * from [tblLanden]",
cnBeActionData)
Dim da2 As New OleDbDataAdapte r("Select * from
[tblLandenPostco des]", cnBeActionData)
da1.FillSchema( dt1, SchemaType.Mapp ed)
da2.FillSchema( dt2, SchemaType.Mapp ed)
Dim rel As New DataRelation("F KPostcLanden_Po stcodes",
dsLandenPostcod es.Tables(0).Co lumns("Landcode "),
dsLandenPostcod es.Tables(1).Co lumns("Landcode "))
dsLandenPostcod es.Relations.Ad d(rel)
Dim bsPostcodeLande n As New BindingSource
bsPostcodeLande n.DataMember = dsLandenPostcod es.Tables(0).Ta bleName
bsPostcodeLande n.DataSource = dsLandenPostcod es
Dim bsPostcodes As New BindingSource
bsPostcodes.Dat aSource = bsPostcodeLande n
bsPostcodes.Dat aMember = "FKPostcLanden_ Postcodes"
da1.Fill(dt1)
da2.Fill(dt2)
Me.dgvPostcodeL anden.DataSourc e = bsPostcodeLande n
Me.dgvPostcodes .DataSource = bsPostcodes
End Sub
'************Ei nde code*********** ****