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

Deleting record gives me dbconcurrency exception

I am trying to delete all the records in a table, but I keep getting a
system.data.dbconcurrency exception. Is there an easy was to delete all the
records in a sql table?

Here is my code... i get the error on the dataadapter.update:

MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
'get rid of any records in memory
Me.DataSet11.tblPreReqWorking.Clear()
Me.daPreReqWorking.SelectCommand.CommandText = "Select JobNo, ReqNo, SeqNo
From dbo.tblPreReqWorking"

Me.daPreReqWorking.Fill(Me.DataSet11.tblPreReqWork ing)
MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
Dim myRow As DataRow
For Each myRow In Me.DataSet11.tblPreReqWorking
myRow.Delete()
Next
'this is where i get the dbconcurrency error
Me.daPreReqWorking.Update(Me.DataSet11.tblPreReqWo rking)
'i don't get this far
Me.DataSet11.tblPreReqWorking.Clear()
Nov 20 '05 #1
3 3258
Check your UpdateCommand parameters, they are probably either wrong or
missing.
Regards OHM
Chris Thunell wrote:
I am trying to delete all the records in a table, but I keep getting a
system.data.dbconcurrency exception. Is there an easy was to delete
all the records in a sql table?

Here is my code... i get the error on the dataadapter.update:

MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
'get rid of any records in memory
Me.DataSet11.tblPreReqWorking.Clear()
Me.daPreReqWorking.SelectCommand.CommandText = "Select JobNo, ReqNo,
SeqNo From dbo.tblPreReqWorking"

Me.daPreReqWorking.Fill(Me.DataSet11.tblPreReqWork ing)
MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
Dim myRow As DataRow
For Each myRow In Me.DataSet11.tblPreReqWorking
myRow.Delete()
Next
'this is where i get the dbconcurrency error
Me.daPreReqWorking.Update(Me.DataSet11.tblPreReqWo rking)
'i don't get this far
Me.DataSet11.tblPreReqWorking.Clear()

Nov 20 '05 #2
Hi Chris,

I have replied to you post in another thread. Please try to go there and
pick it up.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| From: "Chris Thunell" <ct******@pierceassociates.com>
| Subject: Deleting record gives me dbconcurrency exception
| Date: Wed, 12 Nov 2003 09:28:09 -0500
| Lines: 24
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uJ**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups:
microsoft.public.dotnet.framework.adonet,microsoft .public.dotnet.languages.v
b
| NNTP-Posting-Host: 24-249-184-208.dsl.lan2wan.com 208.184.249.24
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:156147
microsoft.public.dotnet.framework.adonet:66121
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| I am trying to delete all the records in a table, but I keep getting a
| system.data.dbconcurrency exception. Is there an easy was to delete all
the
| records in a sql table?
|
| Here is my code... i get the error on the dataadapter.update:
|
| MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
| 'get rid of any records in memory
| Me.DataSet11.tblPreReqWorking.Clear()
| Me.daPreReqWorking.SelectCommand.CommandText = "Select JobNo, ReqNo, SeqNo
| From dbo.tblPreReqWorking"
|
| Me.daPreReqWorking.Fill(Me.DataSet11.tblPreReqWork ing)
| MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
| Dim myRow As DataRow
| For Each myRow In Me.DataSet11.tblPreReqWorking
| myRow.Delete()
| Next
| 'this is where i get the dbconcurrency error
| Me.daPreReqWorking.Update(Me.DataSet11.tblPreReqWo rking)
| 'i don't get this far
| Me.DataSet11.tblPreReqWorking.Clear()
|
|
|

Nov 20 '05 #3
It was something to do with the dataadapter not being setup correctly. I
created a new dataadapter with no parameters... and i was then able to
delete all the records in the table. My original datadapter had parameters
like JobNo = xxx which through off the update command i guess.

Thanks everyone for your help!

"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
I am trying to delete all the records in a table, but I keep getting a
system.data.dbconcurrency exception. Is there an easy was to delete all the records in a sql table?

Here is my code... i get the error on the dataadapter.update:

MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
'get rid of any records in memory
Me.DataSet11.tblPreReqWorking.Clear()
Me.daPreReqWorking.SelectCommand.CommandText = "Select JobNo, ReqNo, SeqNo
From dbo.tblPreReqWorking"

Me.daPreReqWorking.Fill(Me.DataSet11.tblPreReqWork ing)
MessageBox.Show(Me.DataSet11.tblPreReqWorking.Rows .Count)
Dim myRow As DataRow
For Each myRow In Me.DataSet11.tblPreReqWorking
myRow.Delete()
Next
'this is where i get the dbconcurrency error
Me.daPreReqWorking.Update(Me.DataSet11.tblPreReqWo rking)
'i don't get this far
Me.DataSet11.tblPreReqWorking.Clear()

Nov 20 '05 #4

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

Similar topics

4
by: XmlAdoNewbie | last post by:
Hi All, I am using Microsoft SQL Enterprise Manager version 8.0 and have created a view from a combination of 4 different tables. I would like to be able to go into sql and open the view and...
0
by: RAllsopp | last post by:
I am having trouble deleting a record from a subform. I actually have a main form with two subforms, one dependent on the record selected in the other. The user selects a record to view on the...
2
by: | last post by:
I have been trying to delete a record with the following code, but not receiving any results, not even an error message. I have verified that I am passing a valid record index and that my...
46
by: DP | last post by:
hi, i've got a form, with a subform in it. i've got a delete button in the subform. the code i;ve got is; Private Sub cmdDeleteRecord_Click() msg = "Are you sure you want to delete this...
2
by: clickon | last post by:
I have set up a GridView control bound to an SQLDataSource control. Depending on which option a user selects in a DropDownList Each datasource is a sethe select command retrieves a list of...
2
by: johnds | last post by:
I am researching the use of physician services that are recorded in a billing database of over 10 million records. I am only interested in the patient's treatment type, and their attributes (age...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
24
by: Frank Swarbrick | last post by:
We have a batch process that inserts large numbers (100,000 - 1,000,000) of records into a database each day. (DL/I database.) We're considering converting it to a DB2 table. Currently we have...
1
by: sphinney | last post by:
All, I'm not sure how to adequately explain my problem in two sentences or less, so at the risk of providing TMI, here's the condensed verion. I have developed an Access 2002 database file that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.