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; //这句写到循环外试以下!!!
解决方案 »
- winfrom datagridview 删除,为什么删除了不是在原来的界面而是返回了上一个界面求解??????
- pictureBox如何知道鼠标是第几次单击这个控件?
- c#存储过程的问题
- 【急】删除服务器端文件的问题!!!
- 谢谢好心人
- 请问Reporting Servies 中少了using Microsoft.ReportingServices.Interfaces的引用,要加入什么DLL?
- 一个很棘手的用UPDATECOMMAND更新数据库的问题(在线等....)
- 如何制作透明窗体?
- .NET远程处理问题 急·!
- .resources文件是什么文件,如何操作?
- 急聘项目经理、技术经理、高级程序员
- 奇怪了,为什么我访问不了System.Web.UI.Design 命名空间?
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();