G
Guest
Hi,
I have an application running on a Windows Mobile 5.0 device and am using
the following code to update tables in a SQL Server Mobile database . For
some tables, the following code works fine but for others the database does
not get updated. The Update method returns the number of records that should
be updated, the RowUpdating event fires but the RowUpdated event does not and
there are no errors thrown.
The tables passed to the sub do not originate from the database, instead
they have been constructed using data from an external source. The tables do
not contain any primary key information.
Filling the datatable from the dataadapter after the update shows that no
changes have been made to the database.
private sub UpdateDatabase(sTable as String, dtTable as DataTable)
' daTable is declared at module level WithEvents
daTable = New SqlCeDataAdapter("SELECT * FROM " & sTable, ssceconn)
With New SqlCeCommandBuilder(daTable)
daTable.InsertCommand = .GetInsertCommand()
daTable.UpdateCommand = .GetUpdateCommand()
daTable.DeleteCommand = .GetDeleteCommand()
End With
daTable.Update(dtTable)
daTable.Dispose()
end sub
I am using VS2005, VB.NET, SQL CE 3.0 and CF 2.0.
I have an application running on a Windows Mobile 5.0 device and am using
the following code to update tables in a SQL Server Mobile database . For
some tables, the following code works fine but for others the database does
not get updated. The Update method returns the number of records that should
be updated, the RowUpdating event fires but the RowUpdated event does not and
there are no errors thrown.
The tables passed to the sub do not originate from the database, instead
they have been constructed using data from an external source. The tables do
not contain any primary key information.
Filling the datatable from the dataadapter after the update shows that no
changes have been made to the database.
private sub UpdateDatabase(sTable as String, dtTable as DataTable)
' daTable is declared at module level WithEvents
daTable = New SqlCeDataAdapter("SELECT * FROM " & sTable, ssceconn)
With New SqlCeCommandBuilder(daTable)
daTable.InsertCommand = .GetInsertCommand()
daTable.UpdateCommand = .GetUpdateCommand()
daTable.DeleteCommand = .GetDeleteCommand()
End With
daTable.Update(dtTable)
daTable.Dispose()
end sub
I am using VS2005, VB.NET, SQL CE 3.0 and CF 2.0.