hello everybody
when i use the following code i find a concurrency exception .
can anybody help me - public void UpdateRec(
-
int id,
-
string name,
-
string title,
-
string home_phone,
-
string mobile_phone,
-
string address,
-
string notes)
-
-
-
{
-
/* First
-
* ..........................
-
* Update the record from RAM
-
............................*/
-
DataRow[] DR = dttel.Select("id=" + id);
-
DR[0].BeginEdit();
-
DR[0]["id"] = id;
-
DR[0]["name"] = name;
-
DR[0]["title"] = title;
-
DR[0]["home_phone"] = home_phone;
-
DR[0]["mobile_phone"] = mobile_phone;
-
DR[0]["address"] =address;
-
DR[0]["notes"] = notes;
-
DR[0].EndEdit();
-
/* Second
-
* .........................
-
* Update the record from Harddisk*/
-
-
string Update_str = "update tel set " +
-
"name=@name," +
-
"title=@title," +
-
"home_phone=@home_phone," +
-
"mobile_phone=@mobile_phone," +
-
"address=@address," +
-
"notes=@notes " +
-
"where id=@id ";
-
-
//defining sqlcommands.
-
OleDbCommand Update_cmd = new OleDbCommand(Update_str, MyConnection.connect());
-
//defining the parameters and the textboxes binded to it.
-
//(1)id,int,nn
-
Update_cmd.Parameters.Add("@id", OleDbType.Integer, 100, "id");
-
Update_cmd.Parameters["@id"].Value = id;
-
//(2)name,char(50),nn
-
Update_cmd.Parameters.Add("@name", OleDbType.LongVarChar, 100, "name");
-
Update_cmd.Parameters["@name"].Value = name;
-
//(3)title,char(10),n
-
Update_cmd.Parameters.Add("@title", OleDbType.LongVarChar, 100, "title");
-
Update_cmd.Parameters["@title"].Value = title;
-
//(4)home_phone,char(10),n
-
Update_cmd.Parameters.Add("@home_phone", OleDbType.LongVarChar, 100, "home_phone");
-
Update_cmd.Parameters["@home_phone"].Value = home_phone;
-
//(5)home_mobile,char(10),n
-
Update_cmd.Parameters.Add("@mobile_phone", OleDbType.LongVarChar, 100, "mobile_phone");
-
Update_cmd.Parameters["@mobile_phone"].Value = mobile_phone;
-
//(6)address,char(50),n
-
Update_cmd.Parameters.Add("@address", OleDbType.LongVarChar, 100, "address");
-
Update_cmd.Parameters["@address"].Value = address;
-
//(7)notes,text,n
-
Update_cmd.Parameters.Add("@notes", OleDbType.LongVarChar, 100, "notes");
-
Update_cmd.Parameters["@notes"].Value = notes;
-
-
//(defining the adapter command
-
DA.UpdateCommand = Update_cmd;
-
-
//update the datasource.
-
try
-
{
-
DA.Update(dttel);
-
-
}
-
catch (DBConcurrencyException ex)
-
{
-
MessageBox.Show("Warning" + ex.Message,
-
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-
}
-
}
1 868
Please paste the full error and line number it relates to. Thanks.
Here is a post that may help: New concurrency error Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave |
last post by:
I have 2 tables, one with names, and another with addresses, joined by their
CIVICID number (unique to the ADDRESSINFO table) in Oracle.
I need to update a field in the NAMEINFO table for a...
|
by: Lauren Quantrell |
last post by:
In VBA, I constructed the following to update all records in
tblmyTable with each records in tblmyTableTEMP having the same
UniqueID:
UPDATE
tblMyTable RIGHT JOIN tblMyTableTEMP ON...
|
by: jimserac |
last post by:
I had previously posted this in an Access forum
with negative results so will try here.
Although this question specifies an Access database,
I also wish to accomplish this with a large MS SQL...
|
by: Josué Maldonado |
last post by:
Hello list,
I have 7.3.4 on RH 8, server hardware is a dual processor Intel Xeon 2.4
Ghz, 2G RAM, 27Gb HD available on postgres partition.
Table cost2est2003 with 99350 recs is described as:...
|
by: robert |
last post by:
been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.
i assume that there is a threshold on the number of columns of
the...
|
by: M. David Johnson |
last post by:
I cannot get my OleDbDataAdapter to update my database
table from my local dataset table. The Knowledge Base
doesn't seem to help - see item 10 below.
I have a Microsoft Access 2000 database...
|
by: Hexman |
last post by:
Hello All,
Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in
my update statement and when trying...
|
by: bughunter |
last post by:
simple query
select * from "Result" res where (res."QID" = 51541 or res."QID" =
51542)
works fine ("SRV-BL"."Result" ~ 900000 rows) and returns 36 rows
but update - no!
update...
|
by: Michel Esber |
last post by:
Hi all,
DB2 V8 LUW FP 15
There is a table T (ID varchar (24), ABC timestamp). ID is PK.
Our application needs to frequently update T with a new value for ABC.
update T set ABC=? where ID...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |