[問題] Arraylist 插入值的問題

看板C_Sharp (C#)作者 (封塵)時間17年前 (2009/02/23 15:14), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/2 (看更多)
我宣告ㄧ個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
if (judge==0) myValue = myValue / 1000;....這行一直跑呀
02/24 20:00, 1F

02/25 21:16, , 2F
if (tempList[j].Equals(pkid)) judge = 1; 這個有改阿
02/25 21:16, 2F
文章代碼(AID): #19eapIQ5 (C_Sharp)
文章代碼(AID): #19eapIQ5 (C_Sharp)