Click here to Skip to main content
15,890,416 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I have a simple UPDATE query (C#) without external links neither groupe.
It works fine but for some records I get the error message here above.
The table tblLR contains 30,000 records and only a small part of them are impacted and there are not the same when the application is run various time.


var query = "UPDATE tblLR " +
                        "SET Location = '" + com + "' " +
                        ", SortedLocation = '" + com + "' " +
                        ", ShortName= '" + topLegacy.ShortName.Replace("'", "''") + "' " +
                        ", Latitude = '" + topLegacy.Latitude + "' " +
                        ", Longitude = '" + topLegacy.Longitude + "' " +
                        " WHERE (IDLR = " + topLegacy.Idlr + " );";


Thanks for your help.
Bernard

What I have tried:

I went on various web sites, saw a lot of articles but none of them solved my issue.
Posted
Updated 13-Dec-17 1:55am
Comments
CHill60 13-Dec-17 7:25am    
Is the access database stored locally or on a server? I have had similar issues on a larger access database on a DFS - no pattern nor rhyme nor reason.
I got over it by opening the database in Exclusive mode but not sure if that will help you.
As an aside you should really use Parameterized Queries and not string concatenation to create your query
BernardBouree 13-Dec-17 10:15am    
The data base is stored loccaly on my HD.
I have tried with the exclusivity but without success.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900