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 again
with the next row I'm looking for, however. I then get this error:
System.Data.DeletedRowInaccessibleException: Deleted row information cannot
be accessed through the row.
The problem seems to be that the dataset deletes the information of the row,
but still keeps the row in it? Now I want to get rid of that one row so my
next run could potentionaly go faster since it has to go over one record
less each time this runs (when the record is below the one that is deleted
offcourse).
Thanks
Joris
While (vi < ds.Tables("vrachtbrieven").Rows.Count)
If (Not
(ds.Tables("docs").Rows(di).Item(0).ToString.Equal s(ds.Tables("vrachtbrieven").Rows(vi).Item(0).ToSt ring)))
Then
erin = False
Else
erin = True
ds.Tables("vrachtbrieven").Rows(vi).Delete()
vi = ds.Tables("vrachtbrieven").Rows.Count
End If
vi += 1
End While 4 7869
Joris,
Deleting of rows is slow, as well be aware that there is a difference
between deleting and removing.
Deleting keeps in some situations the row to make updates to a database
possible
Removing removes the row totally and therefore update is impossible.
But for deleting or removing you can better do a job bottom up with a for
loop
\\\Typed in this message so see it as a kind of pseudo code
For each dr in ds.tables("vrachtbrieven").rows
For i as integer = ds.Tables("docs").Rows.count - 1 to 0 step -1
if
(ds.Tables("docs").Rows(i).Item(0).ToString.Equals (ds.Tables("vrachtbrieven").Rows(i).Item
(0).ToString))) then ds.Tables("docs")Rows(i).Delete
Next
Next
///
I hope this helps,
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht
news:e0**************@TK2MSFTNGP05.phx.gbl... 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 again with the next row I'm looking for, however. I then get this error: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.
The problem seems to be that the dataset deletes the information of the row, but still keeps the row in it? Now I want to get rid of that one row so my next run could potentionaly go faster since it has to go over one record less each time this runs (when the record is below the one that is deleted offcourse).
Thanks Joris
While (vi < ds.Tables("vrachtbrieven").Rows.Count) If (Not (ds.Tables("docs").Rows(di).Item(0).ToString.Equal s(ds.Tables("vrachtbrieven").Rows(vi).Item(0).ToSt ring))) Then erin = False Else erin = True ds.Tables("vrachtbrieven").Rows(vi).Delete() vi = ds.Tables("vrachtbrieven").Rows.Count End If vi += 1 End While
Hi Cor,
thanks for you reply. The situation is that I have 2 tables, one in a
dataset that I go through and another in a dataset wich I go trough every
record of the first table (or until the matching record has been found). Now
this takes quite some time and everyday table 1 gets 2000-3000 extra records
and table 2 1000 extra records, so every day it gets slower. Now I'm looking
for some ways to speed this up and I was thinking that with deleting a
record I could speed it up a bit but since I get this error, it's not that
great sollution it seems.
Could you mayby give some other sollutions on how to speed things up? Would
a select from sql database be faster?
Thanks
Joris
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oz**************@TK2MSFTNGP02.phx.gbl... Joris,
Deleting of rows is slow, as well be aware that there is a difference between deleting and removing. Deleting keeps in some situations the row to make updates to a database possible Removing removes the row totally and therefore update is impossible.
But for deleting or removing you can better do a job bottom up with a for loop
\\\Typed in this message so see it as a kind of pseudo code For each dr in ds.tables("vrachtbrieven").rows For i as integer = ds.Tables("docs").Rows.count - 1 to 0 step -1 if (ds.Tables("docs").Rows(i).Item(0).ToString.Equals (ds.Tables("vrachtbrieven").Rows(i).Item (0).ToString))) then ds.Tables("docs")Rows(i).Delete Next Next ///
I hope this helps,
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht news:e0**************@TK2MSFTNGP05.phx.gbl... 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 again with the next row I'm looking for, however. I then get this error: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.
The problem seems to be that the dataset deletes the information of the row, but still keeps the row in it? Now I want to get rid of that one row so my next run could potentionaly go faster since it has to go over one record less each time this runs (when the record is below the one that is deleted offcourse).
Thanks Joris
While (vi < ds.Tables("vrachtbrieven").Rows.Count) If (Not (ds.Tables("docs").Rows(di).Item(0).ToString.Equal s(ds.Tables("vrachtbrieven").Rows(vi).Item(0).ToSt ring))) Then erin = False Else erin = True ds.Tables("vrachtbrieven").Rows(vi).Delete() vi = ds.Tables("vrachtbrieven").Rows.Count End If vi += 1 End While
Joris,
Did you try my sample?
(The inner for loop can be exited of course with an Exit For and than the
then becomes an then with an end if.)
I assume that in fact every day this has to be done completely, althoug as I
understand you well, than you can use in the outerloop use instead of the
complete table only the additions for this day, which you probably can get
with a where clause.
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht
news:ub**************@TK2MSFTNGP03.phx.gbl... Hi Cor, thanks for you reply. The situation is that I have 2 tables, one in a dataset that I go through and another in a dataset wich I go trough every record of the first table (or until the matching record has been found). Now this takes quite some time and everyday table 1 gets 2000-3000 extra records and table 2 1000 extra records, so every day it gets slower. Now I'm looking for some ways to speed this up and I was thinking that with deleting a record I could speed it up a bit but since I get this error, it's not that great sollution it seems. Could you mayby give some other sollutions on how to speed things up? Would a select from sql database be faster?
Thanks Joris
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:Oz**************@TK2MSFTNGP02.phx.gbl... Joris,
Deleting of rows is slow, as well be aware that there is a difference between deleting and removing. Deleting keeps in some situations the row to make updates to a database possible Removing removes the row totally and therefore update is impossible.
But for deleting or removing you can better do a job bottom up with a for loop
\\\Typed in this message so see it as a kind of pseudo code For each dr in ds.tables("vrachtbrieven").rows For i as integer = ds.Tables("docs").Rows.count - 1 to 0 step -1 if (ds.Tables("docs").Rows(i).Item(0).ToString.Equals (ds.Tables("vrachtbrieven").Rows(i).Item (0).ToString))) then ds.Tables("docs")Rows(i).Delete Next Next ///
I hope this helps,
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht news:e0**************@TK2MSFTNGP05.phx.gbl... 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 again with the next row I'm looking for, however. I then get this error: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.
The problem seems to be that the dataset deletes the information of the row, but still keeps the row in it? Now I want to get rid of that one row so my next run could potentionaly go faster since it has to go over one record less each time this runs (when the record is below the one that is deleted offcourse).
Thanks Joris
While (vi < ds.Tables("vrachtbrieven").Rows.Count) If (Not (ds.Tables("docs").Rows(di).Item(0).ToString.Equal s(ds.Tables("vrachtbrieven").Rows(vi).Item(0).ToSt ring))) Then erin = False Else erin = True ds.Tables("vrachtbrieven").Rows(vi).Delete() vi = ds.Tables("vrachtbrieven").Rows.Count End If vi += 1 End While
Hi,
Thanks for your response. I have used your advice with the where clause and
this could help me quite a bit :). Why didn't I come up with this...
Joris
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl... Joris,
Did you try my sample?
(The inner for loop can be exited of course with an Exit For and than the then becomes an then with an end if.)
I assume that in fact every day this has to be done completely, althoug as I understand you well, than you can use in the outerloop use instead of the complete table only the additions for this day, which you probably can get with a where clause.
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht news:ub**************@TK2MSFTNGP03.phx.gbl... Hi Cor, thanks for you reply. The situation is that I have 2 tables, one in a dataset that I go through and another in a dataset wich I go trough every record of the first table (or until the matching record has been found). Now this takes quite some time and everyday table 1 gets 2000-3000 extra records and table 2 1000 extra records, so every day it gets slower. Now I'm looking for some ways to speed this up and I was thinking that with deleting a record I could speed it up a bit but since I get this error, it's not that great sollution it seems. Could you mayby give some other sollutions on how to speed things up? Would a select from sql database be faster?
Thanks Joris
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:Oz**************@TK2MSFTNGP02.phx.gbl... Joris,
Deleting of rows is slow, as well be aware that there is a difference between deleting and removing. Deleting keeps in some situations the row to make updates to a database possible Removing removes the row totally and therefore update is impossible.
But for deleting or removing you can better do a job bottom up with a for loop
\\\Typed in this message so see it as a kind of pseudo code For each dr in ds.tables("vrachtbrieven").rows For i as integer = ds.Tables("docs").Rows.count - 1 to 0 step -1 if (ds.Tables("docs").Rows(i).Item(0).ToString.Equals (ds.Tables("vrachtbrieven").Rows(i).Item (0).ToString))) then ds.Tables("docs")Rows(i).Delete Next Next ///
I hope this helps,
Cor
"Joris De Groote" <jo************@skynet.be> schreef in bericht news:e0**************@TK2MSFTNGP05.phx.gbl... 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 again with the next row I'm looking for, however. I then get this error: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.
The problem seems to be that the dataset deletes the information of the row, but still keeps the row in it? Now I want to get rid of that one row so my next run could potentionaly go faster since it has to go over one record less each time this runs (when the record is below the one that is deleted offcourse).
Thanks Joris
While (vi < ds.Tables("vrachtbrieven").Rows.Count) If (Not (ds.Tables("docs").Rows(di).Item(0).ToString.Equal s(ds.Tables("vrachtbrieven").Rows(vi).Item(0).ToSt ring))) Then erin = False Else erin = True ds.Tables("vrachtbrieven").Rows(vi).Delete() vi = ds.Tables("vrachtbrieven").Rows.Count End If vi += 1 End While
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chumley the Walrus |
last post by:
IN my code behind .vb page for a delete records script (this also does
a deletion confirmation with a javascript popup, this gets called on
my front .aspx page with the datagrid), I'm not sure if...
|
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...
|
by: Ray Martin |
last post by:
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...
|
by: Rodger Dusatko |
last post by:
After entering the sql statement da.deletecommand.commandtext = "Delete from
Users where username = @username" I set the parameter to the username I wish
to delete.
This successfully deletes the...
|
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...
| |
by: Irfan |
last post by:
hi,
I have a peculiar behaviour in my DataTable_RowDeleting Event.
When i delete the row first time,
this.DataSet.hasChanges(DataRowState.Deleted) evaluates to false,
and therefore is unable to...
|
by: gigazelle |
last post by:
Hi everyone,
I'm a newbie in VB.net. I have a problem, when I delete a row (using DtTbl.Rows.Remove(DtRow) syntax), and then I save the records into Database (using DtAdapter.Update(Dtset,...
|
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:...
|
by: codemama |
last post by:
I have created xml files in C# using the DataSet ds.WriteXml method.
I now need to take an xml file and be able to do an insert or delete to a table in MS Access.
How would I go about that?
Do...
|
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,...
|
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,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |