473,395 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Concurrency violation

Hi, I get this error when I try to save a datatime field to the database
using OdbcDataAdapter.Update method.
oAdapter.UpdateCommand.CommandText is like: "update aTable set effetive_from
=? where primarykey=?"

The parameter related to this field is like:

oAdapter.UpdateCommand.Paramteres.Add(new OdbcParameter("effective_from",
Odbctype.datetime, 8, "effective_from");

The database is Sybase ASA 9.0. The column effective_from's type is datatime
in the database.

Any suggestions/ideas?

Thanks, Zhuo
Sep 18 '08 #1
3 1904
On Thu, 18 Sep 2008 09:50:08 -0400, Zhuo Li wrote:
Hi, I get this error when I try to save a datatime field to the database
using OdbcDataAdapter.Update method.
oAdapter.UpdateCommand.CommandText is like: "update aTable set
effetive_from =? where primarykey=?"

The parameter related to this field is like:

oAdapter.UpdateCommand.Paramteres.Add(new
OdbcParameter("effective_from", Odbctype.datetime, 8, "effective_from");

The database is Sybase ASA 9.0. The column effective_from's type is
datatime in the database.

Any suggestions/ideas?

Thanks, Zhuo
The simplest way is to disable concurrency checking. In your database
set up click on the table and then check the settings, advanced from
memory and remove it. There are multiple descriptions of how to handle
the problem (generally with autonumber primary keys) but if you are using
a database exclusively it is not worth the effort

Ken
Sep 18 '08 #2
Thank you for your reply. I think that it is something to do with the
datetime field and the dataset. When the dataset tries to save a row to the
database, it compares its "Original data"of the row with what is in the
database. This comparison always result in difference in the datetime field.
If there were a simple solution, there would be something in the dataset
configuration to set the rule of comparing two datetime values only upto
second. Any idea?

Thanks,
Zhuo
"Zhuo Li" <zl*@micros.comwrote in message
news:e8*************@TK2MSFTNGP06.phx.gbl...
Hi, I get this error when I try to save a datatime field to the database
using OdbcDataAdapter.Update method.
oAdapter.UpdateCommand.CommandText is like: "update aTable set
effetive_from =? where primarykey=?"

The parameter related to this field is like:

oAdapter.UpdateCommand.Paramteres.Add(new OdbcParameter("effective_from",
Odbctype.datetime, 8, "effective_from");

The database is Sybase ASA 9.0. The column effective_from's type is
datatime in the database.

Any suggestions/ideas?

Thanks, Zhuo

Sep 19 '08 #3
On Fri, 19 Sep 2008 08:09:44 -0400, Zhuo Li wrote:
Thank you for your reply. I think that it is something to do with the
datetime field and the dataset. When the dataset tries to save a row to
the database, it compares its "Original data"of the row with what is in
the database. This comparison always result in difference in the
datetime field. If there were a simple solution, there would be
something in the dataset configuration to set the rule of comparing two
datetime values only upto second. Any idea?
I can describe a problem I had and perhaps that will help you.

DateTimePicker associated with field. Field was sometime null in the
database. When you picked a new row if (and only if) the field was null
the control got an is null exception and 'rejected' the change of
position. I worked around this by disconnecting the picker from the
database and manually setting it with an onchange event on the
datasource. Very clunky.

I don't get the second message, the difference between two dates is a
timespan. If they are different and you are changing them the database
does not care. If you want to make them null then the automatic
database build will create a method SetFeildNull() and it can be checked
with IsFieldNull().

Ken
Sep 21 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Billy Jacobs | last post by:
I have a client who is getting a concurrency violation error whenever she tries to update a record. I can log in to the site as her simultaneously and update the record with no problem. I can...
3
by: Suzanne | last post by:
Hi All I'm having problems getting my data adapter to throw a concurrency exception with an INSERT command. I want to throw a concurrency exception if an attempt is made to enter a row into...
25
by: nick | last post by:
I'm having trouble updating from a datagrid. It's says "Concurrency violation: the UpdateCommand affected 0 records", though I can't see how it's related to "concurrency". I can insert and delete...
2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
4
by: Steven Nagy | last post by:
Hi Have a problem that consistantly occurs in my applications where using a DataAdapter (OLEDB) and a dataset. Using a simple process of adding a row to the dataset table and then calling the...
2
by: Vladimir Oľura | last post by:
I am building a pocket pc application that requires a datagrid. I am inserting a new row this way: private void mInsert_Click(object sender, System.EventArgs e) { try { DataRow dr =...
4
by: Jerry | last post by:
Hi, I have an app which retrieves data from a sql server table and displays it on a datagrid. If 2 sessions of this app are running and 2 users try to update the same record at about the same...
2
by: Agnes | last post by:
I got a simple form and using databinding manager to do the add new Now , my big trobule is . I can update the 'addnew' record, However, after I new the record, and then amend it , it got...
2
by: BobAchgill | last post by:
Do you know why this error might be happening? Maybe it is because I have two data adapters open on the same MDB file?? If this is the problem... how can I keep them from disturbing each other?...
5
by: Vayse | last post by:
In my save code, most of items save fine. But sometimes I get a concurrency violation message. "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." It happens on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.