Using CurrencyManager

    General discussion

  • bh

    Hi, i have a windows application form that is connected to a database.  I have a datagridview that is connected to the datasource.  When i'm on a particular row, i would like to check if the information in this row differs of the same row in the database.  For example another user has already made a change to this row from a different application.  How can i accomplish this? Here is what i have.  





    Thanks so much.


    Monday, November 08, 2010 11:00 PM

All replies

  • clientsTableAdapter.GetData()

    and compare the returned DataTable with the one from ambtransDataSet.

    Tuesday, November 09, 2010 10:44 AM
  • Your requirement sounds like, managing concurrency exceptions. You can handle such scenarios using Concurrency Control in ADO.NET .

    Read further http://msdn.microsoft.com/en-us/library/22hhd212(v=VS.71).aspx

    Tuesday, November 09, 2010 11:04 AM
  • BH

    Hi Louis, thanks for your reply.  Could you please provide an example of how to compare the ClientsTableAdapter.getData() and the ambtransDataSet?



    Tuesday, November 09, 2010 2:59 PM
  • BH

    Thanks Mike for your reply. The way i understand, managing the concurrency will compare the whole dataset, however, i need only the current row to be compared.



    Tuesday, November 09, 2010 3:01 PM
  • To compare only one row, GetData is a bit heavy. Create a new SQL query taking the key as parameter, it will return a datatable containing only one row. You can then compare each value in the row from the database (first row from the returned datatable), with the one from the dataset.
    Tuesday, November 09, 2010 4:45 PM