473,320 Members | 1,810 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,320 software developers and data experts.

update rows

hello everybody
when i use the following code i find a concurrency exception .
can anybody help me

Expand|Select|Wrap|Line Numbers
  1.  public void UpdateRec(
  2.            int id,
  3.          string name,
  4.          string title,
  5.          string home_phone,
  6.          string mobile_phone,
  7.          string address,
  8.          string notes)
  9.  
  10.  
  11.         {
  12.             /* First 
  13.                      * ..........................
  14.                      * Update the record from RAM
  15.                      ............................*/
  16.             DataRow[] DR = dttel.Select("id=" + id);
  17.             DR[0].BeginEdit();
  18.             DR[0]["id"] = id;
  19.             DR[0]["name"] = name;
  20.             DR[0]["title"] = title;
  21.             DR[0]["home_phone"] = home_phone;
  22.             DR[0]["mobile_phone"] = mobile_phone;
  23.             DR[0]["address"] =address;
  24.             DR[0]["notes"] = notes;
  25.             DR[0].EndEdit();
  26.             /* Second 
  27.                       * .........................
  28.                       * Update the record from Harddisk*/
  29.  
  30.             string Update_str = "update  tel set " +
  31.                         "name=@name," +
  32.                         "title=@title," +
  33.                         "home_phone=@home_phone," +
  34.                         "mobile_phone=@mobile_phone," +
  35.                         "address=@address," +
  36.                         "notes=@notes " +
  37.                         "where id=@id  ";
  38.  
  39.             //defining sqlcommands.
  40.             OleDbCommand Update_cmd = new OleDbCommand(Update_str, MyConnection.connect());
  41.             //defining the parameters and the textboxes binded to it.
  42.             //(1)id,int,nn
  43.             Update_cmd.Parameters.Add("@id", OleDbType.Integer, 100, "id");
  44.             Update_cmd.Parameters["@id"].Value = id;
  45.             //(2)name,char(50),nn
  46.             Update_cmd.Parameters.Add("@name", OleDbType.LongVarChar, 100, "name");
  47.             Update_cmd.Parameters["@name"].Value = name;
  48.             //(3)title,char(10),n
  49.             Update_cmd.Parameters.Add("@title", OleDbType.LongVarChar, 100, "title");
  50.             Update_cmd.Parameters["@title"].Value = title;
  51.             //(4)home_phone,char(10),n
  52.             Update_cmd.Parameters.Add("@home_phone", OleDbType.LongVarChar, 100, "home_phone");
  53.             Update_cmd.Parameters["@home_phone"].Value = home_phone;
  54.             //(5)home_mobile,char(10),n
  55.             Update_cmd.Parameters.Add("@mobile_phone", OleDbType.LongVarChar, 100, "mobile_phone");
  56.             Update_cmd.Parameters["@mobile_phone"].Value = mobile_phone;
  57.             //(6)address,char(50),n
  58.             Update_cmd.Parameters.Add("@address", OleDbType.LongVarChar, 100, "address");
  59.             Update_cmd.Parameters["@address"].Value = address;
  60.             //(7)notes,text,n
  61.             Update_cmd.Parameters.Add("@notes", OleDbType.LongVarChar, 100, "notes");
  62.             Update_cmd.Parameters["@notes"].Value = notes;
  63.  
  64.            //(defining the adapter command
  65.             DA.UpdateCommand = Update_cmd;
  66.  
  67.            //update the datasource.
  68.             try
  69.             {
  70.                 DA.Update(dttel);
  71.  
  72.             }
  73.             catch (DBConcurrencyException ex)
  74.             {
  75.                 MessageBox.Show("Warning" + ex.Message,
  76.                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  77.             }
  78.        }
Jan 24 '08 #1
1 868
kenobewan
4,871 Expert 4TB
Please paste the full error and line number it relates to. Thanks.
Here is a post that may help:
New concurrency error
Jan 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
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...
8
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...
12
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...
3
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:...
16
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...
0
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...
2
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...
1
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...
3
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...
0
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...
0
isladogs
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...
1
isladogs
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...
0
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...
0
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...
1
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)...
1
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....
0
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
0
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...

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.