Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete row in dataview
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01048268
Message ID:
01048286
Views:
21
David,
Try the following code (skip the .Row):
foreach (DataRowView drv in goView)
{
  if (drv["userid"].ToString().Equals("DSMI"))
  {
    drv.Delete();
  }
  else
  {
    drv["userid"] = drv["userid"].ToString() + "Kretek";
  }
}
Also keep in mind thatthe data row is not permanently deleted (from the table) until acceptchanges is issued.

Hope this helps.
Einar



>Tried doing the code below to delete a record from a dataview but its telling me there is no row at that location? I'm not sure if I'm doing this right?
>
>
>foreach (DataRowView drv in goView)
>{
>if (drv["userid"].ToString().Equals("DSMI"))
>{
>drv.Row.Delete();
>}
>else
>{
>drv["userid"] = drv["userid"].ToString() + "Kretek";
>}
>}
>
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform