1:做Tdateset.delete是否會把移標指到下一筆?, |
答題得分者是:cashxin2002
|
vivi666666
初階會員 發表:83 回覆:94 積分:35 註冊:2003-03-05 發送簡訊給我 |
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 發送簡訊給我 |
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 發送簡訊給我 |
引述一段 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 發送簡訊給我 |
引言: 引述一段 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 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |