Home All Groups Group Topic Archive Search About

Dataset.Merge Concurrency violation

Author
9 Dec 2004 3:23 AM
john.paul
I am using SqlClient and OleDbClient classes to copy data from an msaccess db
to a sql server db. These two dbs have the same structure.I want the changes
that have occured in the records in the msaccess db to be updated to the sql
server db.

I am loading data from a table in msaccess into a dataset(dsSrc) and loading
the same table from SQl Server into another dataset(dsDest). then i am
calling the dsDest.merge method to merge the changes in the two datasets.
Upon updatation of dsDest i get the following error from the sql server db

"Concurrency violation: the UpdateCommand affected 0 records"

I am the only user on the 2 databases.

I checked the contents of the dsDest before and after the merge.

BEFORE
  <?xml version="1.0" standalone="yes" ?>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet>
- <Table diffgr:id="Table1" msdata:rowOrder="0">
  <CompanyId>2</CompanyId>
  <CompanyName>PlanTrac</CompanyName>
  <CompanyCode>PLANTRAC</CompanyCode>
  <Logo></Logo>
  <ContactPerson>John Parker</ContactPerson>
  <AddressLine1 />
  <AddressLine2 />
  <TownCityId>109</TownCityId>
  <DistrictID>101</DistrictID>
  <RegionId>104</RegionId>
  <StateID>99</StateID>
  <CountryID>119</CountryID>
  <ZIP>12345</ZIP>
  <Phone1>(123) 456-7890</Phone1>
  <Phone2 />
  <Mobile />
  <FAX>1 (123) 456-7890</FAX>
  <URL>http://www.plantrac.com</URL>
  <Email />
  <BusinessDetails>Someinfo</BusinessDetails>
  <Role1DisplayName>Working Statff</Role1DisplayName>
  <Role2DisplayName>Opp Manager</Role2DisplayName>
  <Role3DisplayName>System Administrator</Role3DisplayName>
  <SystemAdminDisplayName>Sys Admin</SystemAdminDisplayName>
  <SystemAdminEmail>a***@nunet.com</SystemAdminEmail>
  <CustomerSupportDisplayName>Support</CustomerSupportDisplayName>
  <CustomerSupportEmail>a***@nunet.com</CustomerSupportEmail>
  <CustomerFeedBackDisplayName>Feedback</CustomerFeedBackDisplayName>
  <CustomerFeedbackEmail>a***@nunet.com</CustomerFeedbackEmail>
  <LogoName>planheadlogo.gif</LogoName>
  </Table>
  </NewDataSet>
  </diffgr:diffgram>



AFTER

  <?xml version="1.0" standalone="yes" ?>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet>
- <Table diffgr:id="Table1" msdata:rowOrder="0" diffgr:hasChanges="modified">
  <CompanyId>2</CompanyId>
  <CompanyName>PlanTrac</CompanyName>
  <CompanyCode>PLANTRAC</CompanyCode>
  <Logo></Logo>
  <ContactPerson>John Parker</ContactPerson>
  <AddressLine1 />
  <AddressLine2 />
  <TownCityId>109</TownCityId>
  <DistrictID>101</DistrictID>
  <RegionId>104</RegionId>
  <StateID>99</StateID>
  <CountryID>119</CountryID>
  <ZIP>12345</ZIP>
  <Phone1>(123) 456-7890</Phone1>
  <Phone2 />
  <Mobile />
  <FAX>1 (123) 456-7890</FAX>
  <URL>http://www.plantrac.com</URL>
  <Email />
  <BusinessDetails>SomeInfo</BusinessDetails>
  <Role1DisplayName>Working Statff</Role1DisplayName>
  <Role2DisplayName>Opp Manager</Role2DisplayName>
  <Role3DisplayName>System Administrator</Role3DisplayName>
  <SystemAdminDisplayName>Sys Admin</SystemAdminDisplayName>
  <SystemAdminEmail>a***@nunet.com</SystemAdminEmail>
  <CustomerSupportDisplayName>Support</CustomerSupportDisplayName>
  <CustomerSupportEmail>a***@nunet.com</CustomerSupportEmail>
  <CustomerFeedBackDisplayName>Feedback</CustomerFeedBackDisplayName>
  <CustomerFeedbackEmail>a***@nunet.com</CustomerFeedbackEmail>
  <LogoName>planheadlogo.gif</LogoName>
  </Table>
  </NewDataSet>
- <diffgr:before>
- <Table diffgr:id="Table1" msdata:rowOrder="0">
  <CompanyId>2</CompanyId>
  <CompanyName>PlanTrac Change</CompanyName>
  <CompanyCode>PLANTRAC</CompanyCode>
  <Logo></Logo>
  <ContactPerson>John Parker Change</ContactPerson>
  <AddressLine1 />
  <AddressLine2 />
  <TownCityId>109</TownCityId>
  <DistrictID>101</DistrictID>
  <RegionId>104</RegionId>
  <StateID>99</StateID>
  <CountryID>119</CountryID>
  <ZIP>12345</ZIP>
  <Phone1>(123) 456-7890</Phone1>
  <Phone2 />
  <Mobile />
  <FAX>1 (123) 456-7890</FAX>
  <URL>http://www.plantrac.com</URL>
  <Email />
  <BusinessDetails>SomeInfo</BusinessDetails>
  <Role1DisplayName>Working Statff</Role1DisplayName>
  <Role2DisplayName>Opp Manager</Role2DisplayName>
  <Role3DisplayName>System Administrator</Role3DisplayName>
  <SystemAdminDisplayName>Sys Admin</SystemAdminDisplayName>
  <SystemAdminEmail>a***@nunet.com</SystemAdminEmail>
  <CustomerSupportDisplayName>Support</CustomerSupportDisplayName>
  <CustomerSupportEmail>a***@nunet.com</CustomerSupportEmail>
  <CustomerFeedBackDisplayName>Feedback</CustomerFeedBackDisplayName>
  <CustomerFeedbackEmail>a***@nunet.com</CustomerFeedbackEmail>
  <LogoName>planheadlogo.gif</LogoName>
  </Table>
  </diffgr:before>
  </diffgr:diffgram>

I notice that after the merge, the diffgr:before contains the changed values
and the original table is marked (diffgr:hasChanges="modified")

Is this exected. Why am i getting a Concurrency violation.

I would appreciate if someone helped me out for this. If you need any more
information please ask at this thread.

I am using vs.net 2003 with framework 1.1
Thanks in advance

John

AddThis Social Bookmark Button