IF语句想判断一个LISTBOX里面的内容是否为空,这个判断语句该怎么写?
我已经用循环遍历了这个LISTBOX
for(int i=0;i<lb2.Items.Count;i++)
{
this.sqlCommand1.CommandText="insert into C values('"+ztb1.Text+"','"+lb2.Items[i].Text+"')";
this.sqlCommand1.ExecuteNonQuery();
}
但如果该LISTBOX里面为空的话...我还需要补一条SQL语句.
该怎么用语句表达判断该LISTBOX为空呢~?
问题点数:20、回复次数:3Top
1 楼rickjelly2004(每逢佳节倍思亲-------------快乐生活)回复于 2005-05-14 15:26:35 得分 20
for(int i=0;i<lb2.Items.Count-1;i++)
{
this.sqlCommand1.CommandText="insert into C values('"+ztb1.Text+"','"+lb2.Items[i].Text+"')";
this.sqlCommand1.ExecuteNonQuery();
}
if (lb2.items.count==0)Top
2 楼hfwang009(软件民工)回复于 2005-05-14 15:43:47 得分 0
if (lb2.Items.Count == 0)
{}Top
3 楼losteve(不离不弃,至死方休)回复于 2005-05-14 15:50:58 得分 0
汗...果然简单...给分结贴...Top




