输入一个数字,比较大小,变成0

int input_count = Convert.ToInt32(this.txtinNum.Text.Trim()); //输入的数量
int temp = 0;    //记录临时总数
int temp_count = 0; //记录库存总数
Hashtable ht = new Hashtable();
for (int i = 0; i < list.Count; i++)
   {
     temp = list[i].Count + temp_count - input_count;
     if (temp <= 0)
     {
       temp_count += list[i].Count;
       ht.Add(list[i].Id, 0);
     }
     else
     {
       ht.Add(list[i].Id, temp);
       break;
     }
   }

:输入一个数字,跟数据库中的数字集合进行对比,如果数据库中的数量大于输入的数字:数据库中数量-输入数量,否则,就为0;保存在Hashtable中。
posted @ 2012-02-13 14:55  帕丁顿熊  阅读(288)  评论(0编辑  收藏  举报