Hello,
I have the following problem:
I have 2 access databases: 1 for administration, 1 for production. This 2 databases have the exact same table: 'orderDetail'.
When new orders arrive, the new orderDetails from the administrationDB and existing orderDetails from the productionDB are merged in the production-dataset and should be saved in the production-DB.
The merging works, but the dataAdapter doesn't save the new data in the database:
my code:
before the merge the table in prodDS has 3 rows, after merging, it has 8 rows, so no problem with .merge
I don't get any errors, the update just doesn't happen.
If i don't use the commandBuilder, i don't get any errors either, even though i don't have a valid updatecommand
a little help is much appreciated
Thanks already...
I have the following problem:
I have 2 access databases: 1 for administration, 1 for production. This 2 databases have the exact same table: 'orderDetail'.
When new orders arrive, the new orderDetails from the administrationDB and existing orderDetails from the productionDB are merged in the production-dataset and should be saved in the production-DB.
The merging works, but the dataAdapter doesn't save the new data in the database:
my code:
Code:
Public Function updateProductionData(ByVal orderIds As String)
Dim admCnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=//Server/personal/NRW2.mdb"
Dim prodCnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=//Server/personal/NRW_productie.mdb"
Dim admCN As OleDbConnection = New OleDbConnection(admCnString)
Dim prodCN As OleDbConnection = New OleDbConnection(prodCnString)
Dim admDA As OleDbDataAdapter = New OleDbDataAdapter("Select * from tblOrderDetail where orderId in (" & orderIds & ")", admCN)
Dim prodDA As OleDbDataAdapter = New OleDbDataAdapter("Select * from tblOrderDetail", prodCN)
Dim admDS As DataSet = New DataSet
Dim prodDS As DataSet = New DataSet
Dim cb As OleDbCommandBuilder
Try
admCN.Open()
admDA.Fill(admDS, "orderDetail")
admCN.Close()
prodCN.Open()
prodDA.Fill(prodDS, "orderDetail")
prodCN.Close()
cb = New OleDbCommandBuilder(prodDA)
debug.writeLine(prodDS.Tables(0).Rows.Count)
prodDS.Merge(admDS, False)
debug.writeLine(prodDS.Tables(0).Rows.Count)
prodDS.AcceptChanges()
prodDA.Update(prodDS, "orderDetail")
Catch ex As Exception
End Try
End Function
before the merge the table in prodDS has 3 rows, after merging, it has 8 rows, so no problem with .merge
I don't get any errors, the update just doesn't happen.
If i don't use the commandBuilder, i don't get any errors either, even though i don't have a valid updatecommand
a little help is much appreciated
Thanks already...