P
Pitmaster
Hi there,
hoping somebody can help out here. Searched half earth to find a
solution but no success yet. The following code doesn't gave any fault
or warning but doesn't what it is suppose to do.
Can somebody explain why this code does not produce an extra new row in
my database?
Thanks, Nico
************************************************************************
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim VarDataAdapter As New OleDbDataAdapter()
Dim VarConnection As New OleDbConnection()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
VarConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PetChamp.mdb;User
Id=admin;Password=;"
VarDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM
Omzet")
VarDataAdapter.SelectCommand.Connection = VarConnection
Dim newRow As PetChampDataSet.OmzetRow =
Me.PetChampDataSet1.Omzet.NewRow()
newRow.Artikel = "Muis met staart"
newRow.EANcode = "123"
Me.PetChampDataSet1.Omzet.Rows.Add(newRow)
OmzetTableAdapter.Update(PetChampDataSet1)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'PetChampDataSet1.Omzet' table. You can move, or remove it, as needed.
Me.OmzetTableAdapter.Fill(Me.PetChampDataSet1.Omzet)
End Sub
hoping somebody can help out here. Searched half earth to find a
solution but no success yet. The following code doesn't gave any fault
or warning but doesn't what it is suppose to do.
Can somebody explain why this code does not produce an extra new row in
my database?
Thanks, Nico
************************************************************************
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim VarDataAdapter As New OleDbDataAdapter()
Dim VarConnection As New OleDbConnection()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
VarConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PetChamp.mdb;User
Id=admin;Password=;"
VarDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM
Omzet")
VarDataAdapter.SelectCommand.Connection = VarConnection
Dim newRow As PetChampDataSet.OmzetRow =
Me.PetChampDataSet1.Omzet.NewRow()
newRow.Artikel = "Muis met staart"
newRow.EANcode = "123"
Me.PetChampDataSet1.Omzet.Rows.Add(newRow)
OmzetTableAdapter.Update(PetChampDataSet1)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'PetChampDataSet1.Omzet' table. You can move, or remove it, as needed.
Me.OmzetTableAdapter.Fill(Me.PetChampDataSet1.Omzet)
End Sub