線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1935
推到 Plurk!
推到 Facebook!

這樣都會堆棧溢出?

答題得分者是:william
delphi newer
一般會員


發表:1
回覆:3
積分:0
註冊:2003-03-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-03-07 16:25:37 IP:218.14.xxx.xxx 未訂閱
環境:w2k+d7+sql 2k 在dbgrid里通過dblookupcombobox修改自訂的字段的值時,就會堆棧溢出?    procedure TForm1.ADOTable1XRChange(Sender: TField); begin  adotable1.FieldByName('number').Value:='1234'; end;
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-03-07 16:33:57 IP:147.8.xxx.xxx 未訂閱
I guess the change you make in the code will trigger another OnChange event for the field?
delphi newer
一般會員


發表:1
回覆:3
積分:0
註冊:2003-03-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-03-07 16:55:54 IP:218.14.xxx.xxx 未訂閱
引言: I guess the change you make in the code will trigger another OnChange event for the field?
沒有.絕對沒有死循環.
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-03-07 17:02:28 IP:147.8.xxx.xxx 未訂閱
引言:沒有.絕對沒有死循環.
Then it would be rather hard to locate the problem becasue the information provided is not enough.
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-03-07 17:03:34 IP:211.21.xxx.xxx 未訂閱
引言: 環境:w2k d7 sql 2k 在dbgrid里通過dblookupcombobox修改自訂的字段的值時,就會堆棧溢出? procedure TForm1.ADOTable1XRChange(Sender: TField); begin adotable1.FieldByName('number').Value:='1234'; end;
您檢查一下,在procedure TForm1.ADOTable1numberChange(Sender: TField);是否有將值Assigned給adotable1.FieldByName('number').Value 根據我的經驗,在OnChange事件寫程式,一不小心就會造成堆棧溢出(Stack OverFloat),大部分的原因是在自已本身的OnChange事件將值Assigned給自已,如此會一直觸發OnChange事件,造成無窮迴圈,進而造成堆棧溢出(Stack OverFloat) ~小弟淺見,參考看看~
------
~小弟淺見,參考看看~
delphi newer
一般會員


發表:1
回覆:3
積分:0
註冊:2003-03-07

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-03-07 17:26:11 IP:218.14.xxx.xxx 未訂閱
引言:
引言:沒有.絕對沒有死循環.
Then it would be rather hard to locate the problem becasue the information provided is not enough. >< face="Verdana, Arial, Helvetica"> 首先謝謝各位的關注,具体步驟如下: 1>使用adoconnection連接到數据庫,加入兩個tdatasource與tadotable.還有一個dbgrid.除必要的屬性外其余為預設值. 2>adotable1連接到訂單資料表格.adotable2連接到顏色資料表格. 3>因adotable1中有一個color字段,adotable2中有一個number與color字段.所以在adotable1的字段中自訂一個組合字段.目地是在dbgrid中使用dblookupcombobox顯示出顏色的值. 4>在dbgrid中加入所有字段后,撰寫加入的組合字段的onchange事件. 5>onchange字段就只有一句代碼: adotable1.FieldByName('number').Value:='1234'; 6>編譯執行.報錯.
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-03-07 17:51:49 IP:147.8.xxx.xxx 未訂閱
引言:首先謝謝各位的關注,具体步驟如下: 1>使用adoconnection連接到數据庫,加入兩個tdatasource與tadotable.還有一個dbgrid.除必要的屬性外其余為預設值. 2>adotable1連接到訂單資料表格.adotable2連接到顏色資料表格. 3>因adotable1中有一個color字段,adotable2中有一個number與color字段.所以在adotable1的字段中自訂一個組合字段.目地是在dbgrid中使用dblookupcombobox顯示出顏色的值. 4>在dbgrid中加入所有字段后,撰寫加入的組合字段的onchange事件. 5>onchange字段就只有一句代碼: adotable1.FieldByName('number').Value:='1234'; 6>編譯執行.報錯.
It seems that your listed steps are just a few, could you create a new demo (better using Access) and upload it for testing? To make sure there is no infinite loop, would you mind setting a break point on the ADOTable1XRChange (and probably others?) and test again
delphi newer
一般會員


發表:1
回覆:3
積分:0
註冊:2003-03-07

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-03-07 18:07:14 IP:218.14.xxx.xxx 未訂閱
引言: It seems that your listed steps are just a few, could you create a new demo (better using Access) and upload it for testing? To make sure there is no infinite loop, would you mind setting a break point on the ADOTable1XRChange (and probably others?) and test again < face="Verdana, Arial, Helvetica"> 我重新建了一個專案進行測試過了(就一句代碼),但結果還是一樣. 難道是我的w2k or delphi7 or database的原因?
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-03-10 11:02:13 IP:147.8.xxx.xxx 未訂閱
引言:我重新建了一個專案進行測試過了(就一句代碼),但結果還是一樣. 難道是我的w2k or delphi7 or database的原因? < face="Verdana, Arial, Helvetica"> Since you have the very same problem in the new simple project, would you mind posting the project here
系統時間:2024-05-06 18:46:46
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!