foreach( DataRow rowr in ds.Tables[0].Rows )
{
if( int.Parse(rowr["item_id"].ToString()) == 2267 )
{
ds.Tables[0].Rows.Remove( rowr );
}
}return ds; //这句写到循环外试以下!!!
{
if( int.Parse(rowr["item_id"].ToString()) == 2267 )
{
ds.Tables[0].Rows.Remove( rowr );
}
}return ds; //这句写到循环外试以下!!!
private dataset f1()
{
......
foreach( DataRow rowr in ds.Tables[0].Rows )
{
if( int.Parse(rowr["item_id"].ToString()) == 2267 )
{
ds.Tables[0].Rows.Remove( rowr );
//return ds;
}
}
return ds;
}
foreach( DataRow rowr in ds.Tables[0].Rows )
{
if( (int)rowr["item_id"] == 2267 )
{
rowr.Delete();
}
}
ds.AcceptChanges();
int i = 0;while (i<=ds.Tables[0].Rows.Count -1)
{
if( (int)ds.Tables[0].Rows[i]["item_id"] == 2267 )
{
ds.Tables[0].Rows[i].Delete();
}
else
{
i++;
}
}ds.AcceptChanges();