作者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)
推 lemor:if (judge==0) myValue = myValue / 1000;....這行一直跑呀 02/24 20:00
→ maxjoiny:if (tempList[j].Equals(pkid)) judge = 1; 這個有改阿 02/25 21:16