Hi,

In my DataSet, I'm trying to keep track of row deletions, so later I can =
check HasChanges to see if I need to update the datasource. I'm trying =
to delete a specific row in the dataset that I search out from a primary =
key. I've found the DataRow I want to delete and have a reference to =
it.

I've tried this,
myDataSet.myTable.rows.remove(theRowIFound), but it appears this =
actually removes the row, and doesn't just change the rowstate =
(correct?)

The only way I see to delete a row/change rowstate is to have the actual =
ordinal of the row I'm after. How can I get this? Or is there an =
easier way I can delete this row and change the rowstate, using the =
actual reference to the row I have?

Thanks!
--Michael

Re: DataSet / HasChanges / Delete Row by David

David
Fri Oct 22 15:45:56 CDT 2004

This is a multi-part message in MIME format.

------=_NextPart_000_001C_01C4B856.9A0E1950
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I think this is correct, you delete the row from the table=20
then when you update the dataset it will be deleted from the database.

You can use row.RowState =3D DataRowState.Deleted
to check if the row is marked for deletion.



"Raterus" <moc.liamtoh@suretar.reverse> wrote in message =
news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl...
Hi,

In my DataSet, I'm trying to keep track of row deletions, so later I can =
check HasChanges to see if I need to update the datasource. I'm trying =
to delete a specific row in the dataset that I search out from a primary =
key. I've found the DataRow I want to delete and have a reference to =
it.

I've tried this,
myDataSet.myTable.rows.remove(theRowIFound), but it appears this =
actually removes the row, and doesn't just change the rowstate =
(correct?)

The only way I see to delete a row/change rowstate is to have the actual =
ordinal of the row I'm after. How can I get this? Or is there an =
easier way I can delete this row and change the rowstate, using the =
actual reference to the row I have?

Thanks!
--Michael
------=_NextPart_000_001C_01C4B856.9A0E1950
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1458" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I think this is correct, you delete the =
row from=20
the table </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>then&nbsp;when you update the dataset =
it will be=20
deleted&nbsp; from the database.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial size=3D2>You can use&nbsp; </FONT><FONT =
face=3DArial=20
size=3D2>row.RowState =3D DataRowState.Deleted<BR>to check if the row is =
marked for=20
deletion.</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Raterus" &lt;</FONT><A=20
href=3D"mailto:moc.liamtoh@suretar.reverse"><FONT face=3DArial=20
size=3D2>moc.liamtoh@suretar.reverse</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message </FONT><A =
href=3D"news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl"><FONT=20
face=3DArial =
size=3D2>news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial =
size=3D2>Hi,<BR><BR>In my=20
DataSet, I'm trying to keep track of row deletions, so later I can check =

HasChanges to see if I need to update the datasource.&nbsp; I'm trying =
to delete=20
a specific row in the dataset that I search out from a primary =
key.&nbsp; I've=20
found the DataRow I want to delete and have a reference to =
it.<BR><BR>I've tried=20
this,<BR>myDataSet.myTable.rows.remove(theRowIFound), but it appears =
this=20
actually removes the row, and doesn't just change the rowstate=20
(correct?)<BR><BR>The only way I see to delete a row/change rowstate is =
to have=20
the actual ordinal of the row I'm after.&nbsp; How can I get this?&nbsp; =
Or is=20
there an easier way I can delete this row and change the rowstate, using =
the=20
actual reference to the row I=20
have?<BR><BR>Thanks!<BR>--Michael</FONT></BODY></HTML>

------=_NextPart_000_001C_01C4B856.9A0E1950--


Re: DataSet / HasChanges / Delete Row by Miha

Miha
Fri Oct 22 15:50:26 CDT 2004

Hi,

Try row.Delete instead of row.Remove.
it should change the row state if row isn't Added (it will remove it if it
is added).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Raterus" <moc.liamtoh@suretar.reverse> wrote in message
news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl...
Hi,

In my DataSet, I'm trying to keep track of row deletions, so later I can
check HasChanges to see if I need to update the datasource. I'm trying to
delete a specific row in the dataset that I search out from a primary key.
I've found the DataRow I want to delete and have a reference to it.

I've tried this,
myDataSet.myTable.rows.remove(theRowIFound), but it appears this actually
removes the row, and doesn't just change the rowstate (correct?)

The only way I see to delete a row/change rowstate is to have the actual
ordinal of the row I'm after. How can I get this? Or is there an easier
way I can delete this row and change the rowstate, using the actual
reference to the row I have?

Thanks!
--Michael



Re: DataSet / HasChanges / Delete Row by Raterus

Raterus
Fri Oct 22 16:03:08 CDT 2004

I guess I wasn't very clear, I tried that, but I don't know how to get =
the index of the row I'm deleting.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message =
news:%23lyqDjHuEHA.2468@TK2MSFTNGP09.phx.gbl...
> Hi,
>=20
> Try row.Delete instead of row.Remove.
> it should change the row state if row isn't Added (it will remove it =
if it=20
> is added).
>=20
> --=20
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>=20
> "Raterus" <moc.liamtoh@suretar.reverse> wrote in message=20
> news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl...
> Hi,
>=20
> In my DataSet, I'm trying to keep track of row deletions, so later I =
can=20
> check HasChanges to see if I need to update the datasource. I'm =
trying to=20
> delete a specific row in the dataset that I search out from a primary =
key.=20
> I've found the DataRow I want to delete and have a reference to it.
>=20
> I've tried this,
> myDataSet.myTable.rows.remove(theRowIFound), but it appears this =
actually=20
> removes the row, and doesn't just change the rowstate (correct?)
>=20
> The only way I see to delete a row/change rowstate is to have the =
actual=20
> ordinal of the row I'm after. How can I get this? Or is there an =
easier=20
> way I can delete this row and change the rowstate, using the actual=20
> reference to the row I have?
>=20
> Thanks!
> --Michael=20
>=20
>

Re: DataSet / HasChanges / Delete Row by Mike

Mike
Fri Oct 22 16:11:55 CDT 2004

Raterus wrote:

> I've tried this,
> myDataSet.myTable.rows.remove(theRowIFound), but it appears
> this actually removes the row, and doesn't just change the
> rowstate (correct?)

Use theRowIFound.Delete;

This will mark the row as RowState = Deleted, but not remove it from the
Rows collection (as you correctly noted that .Remove() does).

--Mike


Re: DataSet / HasChanges / Delete Row by Miha

Miha
Sat Oct 23 03:27:19 CDT 2004

Huh?
Don't you have a reference to the row itself?
Why do you need an index?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Raterus" <moc.liamtoh@suretar.reverse> wrote in message
news:%23oTvJqHuEHA.2828@TK2MSFTNGP12.phx.gbl...
I guess I wasn't very clear, I tried that, but I don't know how to get the
index of the row I'm deleting.

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23lyqDjHuEHA.2468@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> Try row.Delete instead of row.Remove.
> it should change the row state if row isn't Added (it will remove it if it
> is added).
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> miha at rthand com
> www.rthand.com
>
> "Raterus" <moc.liamtoh@suretar.reverse> wrote in message
> news:ekp3BPHuEHA.1132@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> In my DataSet, I'm trying to keep track of row deletions, so later I can
> check HasChanges to see if I need to update the datasource. I'm trying to
> delete a specific row in the dataset that I search out from a primary key.
> I've found the DataRow I want to delete and have a reference to it.
>
> I've tried this,
> myDataSet.myTable.rows.remove(theRowIFound), but it appears this actually
> removes the row, and doesn't just change the rowstate (correct?)
>
> The only way I see to delete a row/change rowstate is to have the actual
> ordinal of the row I'm after. How can I get this? Or is there an easier
> way I can delete this row and change the rowstate, using the actual
> reference to the row I have?
>
> Thanks!
> --Michael
>
>