Sorry for the delay in the answer and thank you for the attention.
I can post the source code or if you want, a could place the files in a
public ftp server. Here I try to paste the source code.
If you modify th field "valore" in table Padre and try to sync the exception
arise.
Regards. Simone.
********* DB ***********
Table Padre (Father)
Num; Anno; valore
1;"2005";"35345345"
2;"2005";"dfgdfg"
Table provaF (Son)
chiaveF;Num; Anno; valore
100;1;"2005";"ggggg"
101;1;"2005";"ghhhfghrthrh"
102;2;"2005";"hhhhh"
********* Form1.vb ***********
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents DataGrid2 As System.Windows.Forms.DataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents OleDbDataAdapterFIGLIO As
System.Data.OleDb.OleDbDataAdapter
Friend WithEvents OleDbSelectCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbUpdateCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbDeleteCommand1 As System.Data.OleDb.OleDbCommand
Friend WithEvents DataSet11 As test.DataSet1
Friend WithEvents OleDbDataAdapterPADRE As
System.Data.OleDb.OleDbDataAdapter
Friend WithEvents OleDbSelectCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbInsertCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbUpdateCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbDeleteCommand2 As System.Data.OleDb.OleDbCommand
Friend WithEvents OleDbConnection1OLD As System.Data.OleDb.OleDbConnection
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.DataSet11 = New test.DataSet1
Me.DataGrid2 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.OleDbDataAdapterFIGLIO = New System.Data.OleDb.OleDbDataAdapter
Me.OleDbDeleteCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbConnection1OLD = New System.Data.OleDb.OleDbConnection
Me.OleDbInsertCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbUpdateCommand1 = New System.Data.OleDb.OleDbCommand
Me.OleDbDataAdapterPADRE = New System.Data.OleDb.OleDbDataAdapter
Me.OleDbDeleteCommand2 = New System.Data.OleDb.OleDbCommand
Me.OleDbInsertCommand2 = New System.Data.OleDb.OleDbCommand
Me.OleDbSelectCommand2 = New System.Data.OleDb.OleDbCommand
Me.OleDbUpdateCommand2 = New System.Data.OleDb.OleDbCommand
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataGrid2,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.DataSet11.Padre
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(24, 24)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(416, 256)
Me.DataGrid1.TabIndex = 0
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.CultureInfo("it-IT")
'
'DataGrid2
'
Me.DataGrid2.DataMember = ""
Me.DataGrid2.DataSource = Me.DataSet11.provaF
Me.DataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid2.Location = New System.Drawing.Point(472, 24)
Me.DataGrid2.Name = "DataGrid2"
Me.DataGrid2.Size = New System.Drawing.Size(268, 256)
Me.DataGrid2.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 312)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 2
Me.Button1.Text = "Fill Father"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(480, 312)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 3
Me.Button2.Text = "Fill Son"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(360, 312)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 4
Me.Button3.Text = "sync Father"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(664, 312)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 5
Me.Button4.Text = "sync Son"
'
'OleDbDataAdapterFIGLIO
'
Me.OleDbDataAdapterFIGLIO.DeleteCommand = Me.OleDbDeleteCommand1
Me.OleDbDataAdapterFIGLIO.InsertCommand = Me.OleDbInsertCommand1
Me.OleDbDataAdapterFIGLIO.SelectCommand = Me.OleDbSelectCommand1
Me.OleDbDataAdapterFIGLIO.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "provaF", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("Anno", "Anno"), New
System.Data.Common.DataColumnMapping("chiaveF", "chiaveF"), New
System.Data.Common.DataColumnMapping("Num", "Num"), New
System.Data.Common.DataColumnMapping("valore", "valore")})})
Me.OleDbDataAdapterFIGLIO.UpdateCommand = Me.OleDbUpdateCommand1
'
'OleDbDeleteCommand1
'
Me.OleDbDeleteCommand1.CommandText = "DELETE FROM provaF WHERE
(chiaveF = ?) AND (Anno = ? OR ? IS NULL AND Anno IS NUL" & _
"L) AND (Num = ? OR ? IS NULL AND Num IS NULL) AND (valore = ? OR ?
IS NULL AND v" & _
"alore IS NULL)"
Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection1OLD
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_chiaveF",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "chiaveF",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num1",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
'
'OleDbConnection1OLD
'
Me.OleDbConnection1OLD.ConnectionString = "Mode=Share Exclusive;Data
Source=""C:\1locale\test su access\test.mdb"";Provider=""M" & _
"icrosoft.Jet.OLEDB.4.0"";User ID=Admin;"
'
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText = "INSERT INTO provaF(Anno,
chiaveF, Num, valore) VALUES (?, ?, ?, ?)"
Me.OleDbInsertCommand1.Connection = Me.OleDbConnection1OLD
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Anno",
System.Data.OleDb.OleDbType.VarWChar, 50, "Anno"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("chiaveF",
System.Data.OleDb.OleDbType.Integer, 0, "chiaveF"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Num", System.Data.OleDb.OleDbType.Integer,
0, "Num"))
Me.OleDbInsertCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("valore",
System.Data.OleDb.OleDbType.VarWChar, 50, "valore"))
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT Anno, chiaveF, Num,
valore FROM provaF"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1OLD
'
'OleDbUpdateCommand1
'
Me.OleDbUpdateCommand1.CommandText = "UPDATE provaF SET Anno = ?,
chiaveF = ?, Num = ?, valore = ? WHERE (chiaveF = ?) " & _
"AND (Anno = ? OR ? IS NULL AND Anno IS NULL) AND (Num = ? OR ? IS
NULL AND Num I" & _
"S NULL) AND (valore = ? OR ? IS NULL AND valore IS NULL)"
Me.OleDbUpdateCommand1.Connection = Me.OleDbConnection1OLD
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Anno",
System.Data.OleDb.OleDbType.VarWChar, 50, "Anno"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("chiaveF",
System.Data.OleDb.OleDbType.Integer, 0, "chiaveF"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Num", System.Data.OleDb.OleDbType.Integer,
0, "Num"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("valore",
System.Data.OleDb.OleDbType.VarWChar, 50, "valore"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_chiaveF",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "chiaveF",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num1",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
'
'OleDbDataAdapterPADRE
'
Me.OleDbDataAdapterPADRE.DeleteCommand = Me.OleDbDeleteCommand2
Me.OleDbDataAdapterPADRE.InsertCommand = Me.OleDbInsertCommand2
Me.OleDbDataAdapterPADRE.SelectCommand = Me.OleDbSelectCommand2
Me.OleDbDataAdapterPADRE.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "Padre", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("Anno", "Anno"), New
System.Data.Common.DataColumnMapping("Num", "Num"), New
System.Data.Common.DataColumnMapping("valore", "valore")})})
Me.OleDbDataAdapterPADRE.UpdateCommand = Me.OleDbUpdateCommand2
'
'OleDbDeleteCommand2
'
Me.OleDbDeleteCommand2.CommandText = "DELETE FROM Padre WHERE (Anno
= ?) AND (Num = ?) AND (valore = ? OR ? IS NULL AND" & _
" valore IS NULL)"
Me.OleDbDeleteCommand2.Connection = Me.OleDbConnection1OLD
Me.OleDbDeleteCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
'
'OleDbInsertCommand2
'
Me.OleDbInsertCommand2.CommandText = "INSERT INTO Padre(Anno, Num,
valore) VALUES (?, ?, ?)"
Me.OleDbInsertCommand2.Connection = Me.OleDbConnection1OLD
Me.OleDbInsertCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Anno",
System.Data.OleDb.OleDbType.VarWChar, 50, "Anno"))
Me.OleDbInsertCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Num", System.Data.OleDb.OleDbType.Integer,
0, "Num"))
Me.OleDbInsertCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("valore",
System.Data.OleDb.OleDbType.VarWChar, 50, "valore"))
'
'OleDbSelectCommand2
'
Me.OleDbSelectCommand2.CommandText = "SELECT Anno, Num, valore FROM
Padre"
Me.OleDbSelectCommand2.Connection = Me.OleDbConnection1OLD
'
'OleDbUpdateCommand2
'
Me.OleDbUpdateCommand2.CommandText = "UPDATE Padre SET Anno = ?, Num
= ?, valore = ? WHERE (Anno = ?) AND (Num = ?) AND" & _
" (valore = ? OR ? IS NULL AND valore IS NULL)"
Me.OleDbUpdateCommand2.Connection = Me.OleDbConnection1OLD
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Anno",
System.Data.OleDb.OleDbType.VarWChar, 50, "Anno"))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Num", System.Data.OleDb.OleDbType.Integer,
0, "Num"))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("valore",
System.Data.OleDb.OleDbType.VarWChar, 50, "valore"))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Anno",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Anno", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Num",
System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Num",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbUpdateCommand2.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_valore1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"valore", System.Data.DataRowVersion.Original, Nothing))
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(792, 414)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.DataGrid2)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGrid2,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
OleDbDataAdapterPADRE.Fill(DataSet11.Padre)
MsgBox("filled Father")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Try
OleDbDataAdapterPADRE.Update(DataSet11.Padre)
MsgBox("sync Father")
Catch ex As Exception
MsgBox(ex.Message & " source=" & ex.Source & " StackTrace=" &
ex.StackTrace)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Try
OleDbDataAdapterFIGLIO.Fill(DataSet11.provaF)
MsgBox("filled Son")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Try
OleDbDataAdapterFIGLIO.Update(DataSet11.provaF)
MsgBox("sync Son")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class