比如说 文章管理

提供一个批量删除的功能

前台用rediaobutton判断来得到要删除的数组

根据数组长度也就是要删除数据的个数来重复执行删除语句

具体的看代码吧

 

当然这个场合用的不是很恰当

我只是随便拿出来说明下有这个用法

本人小菜一跌 高手请无视

 

 

 

 


        public int DelArticles(int[] ArticlesId)
        {
            
int SuccessCount = 0;
            
for (int i = 0; i < ArticlesId.Length; i++)
            {
                
string sSQL = "delete from Articles where id=" + ArticlesId[i];
                
if (Convert.ToInt16(ExecuteNonQuery(sSQL)) == 1)
                {
                    SuccessCount
++;
                }
            }
            
if (SuccessCount == ArticlesId.Length)
            {
                
return 1;
            }
            
else
            {
                
return 0;
            }
        }
posted on 2008-08-30 01:02  8user  阅读(187)  评论(0编辑  收藏  举报