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

1:做Tdateset.delete是否會把移標指到下一筆?,

答題得分者是:cashxin2002
vivi666666
初階會員


發表:83
回覆:94
積分:35
註冊:2003-03-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-10-06 14:08:38 IP:203.69.xxx.xxx 未訂閱
1:做Tdateset.delete是否會把移標指到下一筆?, 若會,問題2是否就不能做Tmp.delete的動作了.會破壞while迴圈了, 若要讀一筆刪一筆是否要另外方式刪除呢? 2:以下with Tmp 用locate是否不能用 QTmp.Delete 這個指令? with Tmp do begin First; try while not eof do begin if Dcd.Locate('RFMNO', Tmp.FieldByName(PKey).AsString, [loCaseInsensitive]) then raise Exception.Create('該筆單號資料已存在, 不可再挑進來!'); end; Dcd.edit; ..... Tmp.Delete; ...... Dcd.post; finally end; END;
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-10-06 14:36:34 IP:61.221.xxx.xxx 未訂閱
vivi666666 你好: 可能妳寫的程序有錯,稍微在除錯一下    1.with Tmp do begin    First; ... .. . // 要給他     next; // 一下 2.沒關係用就用了唄!!   反正還不都是~找~   只是要在那兒給它變一下 3.改了如下
引言: with Tmp do begin First; try while not eof do begin if Dcd.Locate('RFMNO', Tmp.FieldByName(PKey).AsString, [loCaseInsensitive]) then raise Exception.Create('該筆單號資料已存在, 不可再挑進來!') esle Dcd.edit; ..... Tmp.Delete; ...... Dcd.post; Next; end; finally end; END;
------
======================
昏睡~
不昏睡~
不由昏睡~
timhuang
尊榮會員


發表:78
回覆:1815
積分:1608
註冊:2002-07-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-10-06 14:56:06 IP:203.95.xxx.xxx 未訂閱
引述一段 help 中的資料: Delete method (TDataSet) Deletes the active record and positions the dataset on the next record. Description Call Delete to remove the active record from the database. If the dataset is inactive, Delete raises an exception. Otherwise, Delete: Verifies that the dataset is not empty (and raises an exception if it is). Calls CheckBrowseMode to post any pending changes to a prior record if necessary. Calls the BeforeDelete event handler. Deletes the record. Frees any buffers allocated for the record. Puts the dataset into dsBrowse mode. Resynchronizes the dataset to make the next undeleted record active. If the record deleted was the last record in the dataset, then the previous record becomes the current record. Calls the AfterDelete event handler. 所以你的第一個問題就是[會] 至於第二個問題是沒問題的, 可以操作的.
vivi666666
初階會員


發表:83
回覆:94
積分:35
註冊:2003-03-05

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-10-06 15:19:44 IP:203.69.xxx.xxx 未訂閱
引言: 引述一段 help 中的資料: Delete method (TDataSet) Deletes the active record and positions the dataset on the next record. Description Call Delete to remove the active record from the database. If the dataset is inactive, Delete raises an exception. Otherwise, Delete: Verifies that the dataset is not empty (and raises an exception if it is). Calls CheckBrowseMode to post any pending changes to a prior record if necessary. Calls the BeforeDelete event handler. Deletes the record. Frees any buffers allocated for the record. Puts the dataset into dsBrowse mode. Resynchronizes the dataset to make the next undeleted record active. If the record deleted was the last record in the dataset, then the previous record becomes the current record. Calls the AfterDelete event handler. 所以你的第一個問題就是[會] 至於第二個問題是沒問題的, 可以操作的.
那是不是表示有做delete時,可不用做next的動作,因delete時已自動next到下一筆
cashxin2002
版主


發表:231
回覆:2555
積分:1937
註冊:2003-03-28

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-10-06 15:31:50 IP:63.84.xxx.xxx 未訂閱
您好!    當DataSet在做Delete的動作時, 資料錄指針會自動移到該刪除之筆數的后一筆, 不需要再用Next方法來移動, 比如說當前資料錄為第5筆, 當您做了Delete之后, 當前記錄指針就自動移到第6筆, 如果此時您再加以Next的話, 就會把當前資料錄指針移到第7筆了.    參考看看!    ===================== 努力,相信會獲得美麗! 忻晟
------
忻晟
系統時間:2024-06-01 23:13:49
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!