Solved

System.Data.DBConcurrencyException

Posted on 2004-08-22
7
468 Views
Last Modified: 2012-05-05
I am accessing an access database with a couple tables in it, i created data adapters for all the tables and i made one dataset with all the tables in it, probably not the best, but it works.  I have a 1-many relationship with my employees and available tables.  when i change the available table then call the
Update(dataset, "tablename") method I get a System.Data.DBConcurrencyException.

  I thought maybe I was passing bad data, so i just tried deleting a row from the table...
dataset.tables["available"].Rows[0].Delete(); then called the update...
Adapter.Update(dataset,"table"); and i get the same exception.  When I do this it gives me additional information:  Concurrency violation: the DeleteCommand affected 0 records.
0
Comment
Question by:johnduff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 2

Author Comment

by:johnduff
ID: 11867135
Alright, I got the delete to work...the command builder gives you a System.Data.DBDate, changed that to just Date and it works....now I'm habing problem adding something new to the table, I think it is a similar issue.  FYI  i have two date fields that I'm using for the TIME....so what i'm putting into the db is a DateTime object...hope someone can help
0
 
LVL 1

Expert Comment

by:cdmackie
ID: 11886068
Are you using IDENTITY columns? - They had caused similar problems for me, when I was using an event (DataChanged) to ready the last value of the Identify for an Insert.

Also remember Access locks the whole table when you start updating, so you cannot have multiple connections on this. You might want to consider switching to MSDE (or SQL Server lite).

0
 
LVL 2

Author Comment

by:johnduff
ID: 11888081
I'm not using identity columns, i don't think, i'm not sure what those are.  I'm only opening the connection once, so i don't have that other problem either.  I tried doing my own oleDBCommand Insert command and it dosn't work either, this is what i have:

System.Data.OleDb.OleDbCommand c = new System.Data.OleDb.OleDbCommand("INSERT INTO [GeneralAvailTimeSlot] (Day, EmployeeID, TimeFrom, TimeTo) VALUES ("+ 5 +",44222,"+ new DateTime(2000,5,5,7,0,0) +"," + new DateTime(2000,5,5,13,0,0)+ ")", this.oleDbConnection1);
                  this.oleDbConnection1.Open();
                  
                  c.ExecuteNonQuery();
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:cdmackie
ID: 11889788
The problem might be related to the Date field in your table. Have you tried a similar test but after having removed the Date fields from the table?

It seems Access truncates the Time information in the DATE/TIME field, leaving only the DATE.

This google thread might explain it too.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=eOeCLQVMDHA.2768%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3D%2522Access%2520Database%2520Updates%2522%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DN%26tab%3Dwg
0
 
LVL 2

Author Comment

by:johnduff
ID: 11893779
I think I solved this on my own, when I want up to where the command builder created the Insert and Update commands i just put [] around the column names and now it works, I think Day is a reserved word in access and that was one of my columns.
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 12142501
Submitted to PAQ with points refunded (100)

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
c#, datatable, aspx 4 52
C# DateTime Help 6 47
GET INFO ABOUT WHAT THE PRINTER IS DOING ? 11 76
C# How to display the first five answers that have smallest value? 16 43
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question