Forcing .HasChanges without making changes
Is there a way to change the DataSet.HasChanges method to True without actually changing any values in the DataSet.
I'm working with sending updates to a Pervasive SQL Data Source (ugh!). We have been wrestling with the Pervasive folks about the following issue which is not my question but is the reason I ask it.
When connecting to a Pervasive Database, .NET is unable to identify the key definitions and thus unable to create the default UpdateCommand strings for a DataAdapter. Even though the Data Sources and DataAdapters are using the correct drivers and such, it still with not generate automatic UpdateCommand strings. I therefore have to do this manually, like this.
SQLUpdateCommand.Connection = PervasiveOLEDBDriver
SQLUpdateCommand.CommandText = "UPDATE Customers " & _
"SET Discount = '20' WHERE CustomerNumber = '12345'"
DataAdapter.UpdateCommand = SQLUpdateCommand
DataAdapter.Update(DataSet, "Customers")
I have to manually build that update command for each update. The problem though, is that the above code (namely the .Update Method) will run without error BUT WILL NOT ACTUALLY UPDATE THE DATABASE unless changes to the DataSet are detected. Whatever changes were made to the dataset don't matter because only what is hardcoded into the update string is sent.e string.
There are several workarounds that I could use. I'm limited because my Dataset is bound to a datagrid that I don't want to reflect the changes, so I don't want to make any changes that would be seen. I might be able to do this:
DataSet.Tables("Customers").Row(0).Item("Name") = DataSet.Tables("Customers").Row(0).Item("Name")
But I hate having to write stupid code with comments to explain why this line is there. I would like to be able to do this,
DataSet.HasChanges = True
but .HasChanges is a method, not a property.
Does anyone know of a way to make that HasChanges method return true without making changes to the dataset.

