Now when I debug and look into the Dataset Visualiser I see that the column which is supposed to be autonumber and primary key has nothing in it.
myAuditTable = myTable.Copy
Dim ProductRawMaterial As DataColumn = New DataColumn
ProductRawMaterial.DataType = System.Type.GetType("System.Int64")
ProductRawMaterial.AllowDBNull = False
ProductRawMaterial.Caption = "ProductRawMaterial"
ProductRawMaterial.ColumnName = "ProductRawMaterial"
ProductRawMaterial.AutoIncrement = True
ProductRawMaterial.AutoIncrementSeed = GetmyProductRawMaterialNumber()
ProductRawMaterial.AutoIncrementStep = 1
myAuditTable.Columns.Add(ProductRawMaterial)
Dim myKonn As OleDbConnection = frmLogIn.Connn
Dim oledbCmdBuilderAudit As OleDbCommandBuilder
Dim sqlAudit As String = "select * from ProductRawMaterial WHERE ProductCode=@ProductCode"
Dim oledbAdapterAudit As OleDbDataAdapter = New OleDbDataAdapter(sqlAudit, myKonn)
oledbAdapterAudit.SelectCommand.Parameters.AddWithValue("@ProductCode", txtProductCode.Text)
oledbCmdBuilderAudit = New OleDbCommandBuilder(oledbAdapterAudit)
changes = myTable.GetChanges()
oledbCmdBuilderAudit.ConflictOption = ConflictOption.OverwriteChanges
If changes IsNot Nothing Then
oledbAdapterAudit.AcceptChangesDuringUpdate = False
oledbAdapterAudit.Fill(myAuditTable)
'oledbAdapterAudit.Update(myAuditTable)
End If
myConn.Close()

New Topic/Question
Reply




MultiQuote


|