日期:2014-05-19  浏览次数:20455 次

想删除子串,remove运行无效,请大家帮我看看哪里出了问题。
代码如下:
for(int   i   =   0   ;i   <   this.SelectedPar_ListBox.Items.Count;i   ++)
{
if(this.SelectedPar_ListBox.Items[i].Selected)
{


if(i!=0)
{
removedSql= ", "+this.SelectedPar_ListBox.Items[i].Value   +   "   AS   "   +this.SelectedPar_ListBox.Items[i].Text;
startIndex=sql.IndexOf(removedSql);
length=removedSql.Length;

}
else
{
removedSql=this.SelectedPar_ListBox.Items[i].Value   +   "   AS   "   +this.SelectedPar_ListBox.Items[i].Text;
startIndex=sql.IndexOf(removedSql);
length=removedSql.Length;

}
sql.Remove(startIndex,length);
this.SelectedPar_ListBox.Items.Remove(this.SelectedPar_ListBox.Items[i]);

}

}//

------解决方案--------------------
那就进来抢分了。