[問題] Arraylist 插入值的問題
我宣告ㄧ個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)
推
02/24 20:00, , 1F
02/24 20:00, 1F
→
02/25 21:16, , 2F
02/25 21:16, 2F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章