473,395 Members | 1,516 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.

How to handle deleted rows?

I have two tables in the dataset:
-Invoice header which contains invoice total (Parent table)
-Invoice line which contains line item details (Child table)

I am using a data adapter to update the actual database
There are appropriate table relations

Here is the problem: If I delete a row from the Invoice_line I want to
recalculate the invoice total. I use a loop to recalculate the total line
item cost using the code below:, but I get an error (Deleted row information
cannot be accessed through the row). How can I loop thru the active records
without getting this error? I have tried using GetChildRows("invoice_table",
DataRowVersion.Proposed), but I get the error (There is no Proposed data to
access.).

If I use DatasetAll.AcceptChanges right after doing the delete, I don't get
the error, but then the OledbDataAdapter.Update does not do the
update/delete.

Code:
invoice_total = 0

' if a line is deleted this fails with an error due to no version

For Each child In Parent.GetChildRows("invoice_table")

invoice_total = invoice_total + (child("qty") *
child("unit_cost"))

Next child

OleDbDataAdapter1.Update(DataSetAll1)

OleDbDataAdapter2.Update(DataSetAll1)


Nov 20 '05 #1
1 1257
Cor
Hi Ray,

Not that I see it clear, but why is this not?

OleDbDataAdapter1.Update(DataSetAll1,"parentTable" )
OleDbDataAdapter2.Update(DataSetAll1,"childTable")

Cor
Nov 20 '05 #2

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

Similar topics

1
by: iam247 | last post by:
Hi I am a relative beginner with SQL and ASP. With some help after previous posts I have a page which successfully requests querystrings from another page and deletes a record from an access...
2
by: raffe | last post by:
Hi all. I'm struggeling with a problem. I trying to do something very simple. I have a DataSet containing two tables TableA and TableB. I use TableA.GetChildren("relationName") in order to get...
5
by: Albert | last post by:
Does anyone know if it is possible to get information out of a datarow which has been deleted? Thanks, Albert
3
by: Zorpiedoman | last post by:
Is this true: An existing row in a data table that is deleted still exists in the rows collection, but it is marked as deleted (rowstate = deleted) But If a row that was added to the data...
2
by: Russell Smith | last post by:
Postgresql 7.4.5 The following VACUUMs were run within a couple of minutes of each other completing. This table concerned is a table that has not been changed in a long time. (a month) There...
4
by: Joris De Groote | last post by:
Hi, (my code is @ the bottom of this message) I have a piece of code that runs the rows of a dataset until it finds the one needed. When he finds it, I delete that row and start all over...
2
weaknessforcats
by: weaknessforcats | last post by:
Handle Classes Handle classes, also called Envelope or Cheshire Cat classes, are part of the Bridge design pattern. The objective of the Bridge pattern is to separate the abstraction from the...
4
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I'm working in Visual Studio 2005 and C#. I have a DataTable with many rows. The user can delete a row. After the row is deleted, I'd like to column values for the deleted row, but any attempt to...
0
by: ZSvedic | last post by:
Hi all, I need to display DataRows with RowState.Deleted inside DataGridView, in a way that such rows have strikethrough font. Here is the screenshot how it should look like:...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: 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
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...

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.