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 when you update the dataset =
it will be=20
deleted from the database.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<P><FONT face=3DArial size=3D2>You can use </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> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"Raterus" <</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>> 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. I'm trying =
to delete=20
a specific row in the dataset that I search out from a primary =
key. 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. How can I get this? =
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--