為什麼 if 不能有兩個條件?? |
缺席
|
it1506
初階會員 ![]() ![]() 發表:33 回覆:89 積分:49 註冊:2011-02-16 發送簡訊給我 |
在 rave report 的一個 datatext ,我做了一個 getValue 事件
[code delphi] if (y<=0) then value:=''; end; [/code] 這樣可以過,沒問題 if (y<=0) or (x>=999) then value:=''; end; [/code] 這樣雖然complier會過 但是執行時確會跳出一個 First chance exception at $74F5B727. Exception class EAccessViolation with message 'Access violation at address 00407218 in module 'Project1.exe'. Read of address 015D6878'. Process Project1.exe (16224) 這個錯誤 x,y都是currency 很奇怪, or改and 也是一樣錯誤 到底是哪裡出了問題?? 最後,論壇的程式碼區塊怪怪的, 不會很正常顯示...有時會出現 或其他tag
|
herbert2
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:58 回覆:640 積分:894 註冊:2004-04-16 發送簡訊給我 |
|
tick228
高階會員 ![]() ![]() ![]() ![]() 發表:1 回覆:47 積分:104 註冊:2003-11-03 發送簡訊給我 |
|
ANDY8C
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:114 回覆:582 積分:299 註冊:2006-10-29 發送簡訊給我 |
|
it1506
初階會員 ![]() ![]() 發表:33 回覆:89 積分:49 註冊:2011-02-16 發送簡訊給我 |
|
老大仔
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:78 回覆:837 積分:1088 註冊:2006-07-06 發送簡訊給我 |
建議您放上比較完整的程式碼
這樣大家才方便解決問題~ ===================引 用 it1506 文 章=================== 大家說的 都不是發生錯誤的原因 至今我也找不到為何會錯 在rave report裡 ,它的code是有點不一樣的 例如: if true then begin x:=0; end; 這時complier就會出現錯誤, 它不認得 "begin" 這個關鍵字,它還有很多關鍵字不認得 至於then後面幹嘛還要加 end; 這是寫程式的習慣, 我一定會把區塊分好,方便閱讀 if true {...} if true then begin ..... end; |
it1506
初階會員 ![]() ![]() 發表:33 回覆:89 積分:49 註冊:2011-02-16 發送簡訊給我 |
那個 value是個數字 在getvalue事件中自帶參數.
我本來的寫法是 [code delphi] var x,z :currency; z:=strtocurr(value); x:=dataview3.fieldbyname('r_max').ascurrency; if (x<=0) or (z>=999) then value:=''; end; [/code] 可是會出錯, 目前可運作的程式碼 [code delphi] 請在此區域輸入程式碼 var x,z :currency; z:=strtocurr(value); if (z>=999) then value:=''; end; x:=dataview3.fieldbyname('r_max').ascurrency; if (x<=0) then value:=''; end; ===================引 用 老大仔 文 章=================== 建議您放上比較完整的程式碼 這樣大家才方便解決問題~ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |