作者maxjoiny (封尘)
看板C_Sharp
标题[问题] Arraylist 插入值的问题
时间Mon Feb 23 15:14:25 2009
我宣告ㄧ个list去sql捞data
并用add去加入到list内(因为有时候回传的值不止ㄧ个)
然後利用 tempList[j].Equals(pkid) 去判断int的pkid的值
这样有错误吗? 我code是执行成功 但是有bug 所有值都会被/1000
ArrayList tempList = new ArrayList();
// Add the new DataTable to the DataSet.
// ArrayList List = new ArrayList();
for (int k = 0; k < temp_value.Length; k++)
{
tempList.Add(base.Select_account_map(temp_value.ToString()));
}
if (hashTable.Contains(temp_data2[0]))//如果有那个科目
{
int pkid = Convert .ToInt32 ( hashTable[temp_data2[0]]);
decimal myValue = Convert.ToDecimal(temp_data2[1]);
FileInfo _myfile = new FileInfo(file_name);
for (int j = 0; j<tempList.Count; j++)
{
if (tempList[j].Equals(pkid)) judge = 1;
//除以一千
}
if (judge==0) myValue = myValue / 1000;
下面是我的sql语法的code
public ArrayList Select_account_map(string account_us)
{
return base.GetArrayList("Select account_pkid from account_map
where account_us = '" + account_us + "' ");
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.121.197.106
※ 编辑: maxjoiny 来自: 140.121.197.106 (02/23 15:25)
1F:推 lemor:if (judge==0) myValue = myValue / 1000;....这行一直跑呀 02/24 20:00
2F:→ maxjoiny:if (tempList[j].Equals(pkid)) judge = 1; 这个有改阿 02/25 21:16