I am trying to delete all the records in a table, but I keep getting a
system.data.dbc oncurrency 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.upd ate:
MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count)
'get rid of any records in memory
Me.DataSet11.tb lPreReqWorking. Clear()
Me.daPreReqWork ing.SelectComma nd.CommandText = "Select JobNo, ReqNo, SeqNo
From dbo.tblPreReqWo rking"
Me.daPreReqWork ing.Fill(Me.Dat aSet11.tblPreRe qWorking)
MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count)
Dim myRow As DataRow
For Each myRow In Me.DataSet11.tb lPreReqWorking
myRow.Delete()
Next
'this is where i get the dbconcurrency error
Me.daPreReqWork ing.Update(Me.D ataSet11.tblPre ReqWorking)
'i don't get this far
Me.DataSet11.tb lPreReqWorking. Clear() 3 3274
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.dbc oncurrency 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.upd ate:
MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count) 'get rid of any records in memory Me.DataSet11.tb lPreReqWorking. Clear() Me.daPreReqWork ing.SelectComma nd.CommandText = "Select JobNo, ReqNo, SeqNo From dbo.tblPreReqWo rking"
Me.daPreReqWork ing.Fill(Me.Dat aSet11.tblPreRe qWorking) MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count) Dim myRow As DataRow For Each myRow In Me.DataSet11.tb lPreReqWorking myRow.Delete() Next 'this is where i get the dbconcurrency error Me.daPreReqWork ing.Update(Me.D ataSet11.tblPre ReqWorking) 'i don't get this far Me.DataSet11.tb lPreReqWorking. Clear()
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******@pierc eassociates.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.publi c.dotnet.framew ork.adonet,micr osoft.public.do tnet.languages. v
b
| NNTP-Posting-Host: 24-249-184-208.dsl.lan2wan .com 208.184.249.24
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:156147
microsoft.publi c.dotnet.framew ork.adonet:6612 1
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
|
| I am trying to delete all the records in a table, but I keep getting a
| system.data.dbc oncurrency 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.upd ate:
|
| MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count)
| 'get rid of any records in memory
| Me.DataSet11.tb lPreReqWorking. Clear()
| Me.daPreReqWork ing.SelectComma nd.CommandText = "Select JobNo, ReqNo, SeqNo
| From dbo.tblPreReqWo rking"
|
| Me.daPreReqWork ing.Fill(Me.Dat aSet11.tblPreRe qWorking)
| MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count)
| Dim myRow As DataRow
| For Each myRow In Me.DataSet11.tb lPreReqWorking
| myRow.Delete()
| Next
| 'this is where i get the dbconcurrency error
| Me.daPreReqWork ing.Update(Me.D ataSet11.tblPre ReqWorking)
| 'i don't get this far
| Me.DataSet11.tb lPreReqWorking. Clear()
|
|
|
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******@pierc eassociates.com > wrote in message
news:uJ******** ******@TK2MSFTN GP10.phx.gbl... I am trying to delete all the records in a table, but I keep getting a system.data.dbc oncurrency 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.upd ate:
MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count) 'get rid of any records in memory Me.DataSet11.tb lPreReqWorking. Clear() Me.daPreReqWork ing.SelectComma nd.CommandText = "Select JobNo, ReqNo, SeqNo From dbo.tblPreReqWo rking"
Me.daPreReqWork ing.Fill(Me.Dat aSet11.tblPreRe qWorking) MessageBox.Show (Me.DataSet11.t blPreReqWorking .Rows.Count) Dim myRow As DataRow For Each myRow In Me.DataSet11.tb lPreReqWorking myRow.Delete() Next 'this is where i get the dbconcurrency error Me.daPreReqWork ing.Update(Me.D ataSet11.tblPre ReqWorking) 'i don't get this far Me.DataSet11.tb lPreReqWorking. Clear()
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 select a row and
delete that row however this seem impossible right now. I am not sure
if it's possible to delete a row from a view?? Or could it be that
these tables are all interconnected and in order to delete a record
that is joined to one or more...
|
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 main form and
then can add/edit info on the first subform, which then allows you to
enter related info on the second subform. When I try to delete a
record from the first subform (and cascade all related records from
the second subform), the...
|
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 connection is correct. I'm new to
ADO.Net and this is driving me crazy. Thanks in advance.
Private Sub RecDel(ByVal intRecIndex As Integer)
Try
Me.Cursor = Cursors.WaitCursor
Dim myConnection As New SqlConnection(strSqlConnection)...
|
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 film rental record?"
Style = vbYesNo + vbQuestion + vbDefaultButton2
|
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 key/value pairs from a spefied
table. I am using a select query in the form of
SELECT PrimaryKey AS ID, Value AS Description from sometable
So that the gridview fields can always be bound to ID and Description fields
irespective of the table the...
| |
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 and sex).
Simple enough, but the DB is used to record journal entries and
adjustments. If a patient gets recoded, then that is entered as a
separate record with a negative unit. Typically there are three
records:
patient# treatment# ...
|
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 include them in the set that is displayed to the user) but I don't
want to delete the corresponding row from the database.
I've tried using the .Rows.Remove() method but an exception is thrown to say
I don't have a 'delete' command in the data...
|
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 logic in place that, prior
to inserting any data, reads the first input record and checks to see if it
already exists in the table. If the record already exists there are two
options:
1) Don't continue, because you already ran this job today!
2)...
|
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 contains a form, multiple queries and multiple reports. The purpose of the form is to allow the user to run various queries against my company's Sybase server and display a report.
Since the queries return ADO recordsets from the Sybase server,...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |