有關 DELPHI 語法, WITH ... DO 與 DELETE |
尚未結案
|
小蚊子
中階會員 ![]() ![]() ![]() 發表:55 回覆:267 積分:94 註冊:2002-06-08 發送簡訊給我 |
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 問題 : (問1) 原 [程式A] 可以順利執行,但改為 [程式B]的寫法後, 就是用 ADODataSet_2.first; nRec :=0; while not ADODataSet_2.FieldCount - 1 do s := s Delete(s, Length(s), 1); // 註 (1A) sRecFields := s; v := ADODataSet_2.Next; end; end; // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = // 修改後的 [程式B] ( 會有些問題) // 複製資料庫的資料 // ------------------------------------------------------------------ var i , nREC : integer; s: string; v: variant; sRecFields , sTmp: string; begin first; nRec :=0; while not FieldCount - 1 do s := s Delete(s, Length(s), 1); // 註 (1A) if s<>'' then s := copy( s , 1 ,Length(s)-1 ); // 註 (1B) sRecFields := s; v := Next; end; END; // WITH ADODataSet_2 end; // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 謝謝您 編輯記錄
小蚊子 重新編輯於 2008-06-03 15:10:43, 註解 無‧
|
RootKit
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:16 回覆:358 積分:419 註冊:2008-01-02 發送簡訊給我 |
|
eaglewolf
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:4 回覆:268 積分:429 註冊:2006-07-06 發送簡訊給我 |
若改成底下這樣,不可以嗎?
[code delphi] var i , nREC : integer; s: string; v: variant; sRecFields , sTmp: string; begin with ADODataSet_2 do begin first; nRec :=0; while not Eof do begin ADODataSet_1.Insert; for i := 0 to FieldCount - 1 do begin s := Fields[i].FieldName; v := FieldByName(s); ADODataSet_1.FieldByName(s).Value := v; end; ADODataSet_1.Post; Next; end; END; end; [/code]
------
先查HELP 再查GOOGLE 最後才發問 沒人有義務替你解答問題 在標題或文章中標明很急 並不會增加網友回答速度 Developing Tool: 1.Delphi 6 2.Visual Studio 2005 3.Visual Studio 2008 DBMS: MS-SQL |
小蚊子
中階會員 ![]() ![]() ![]() 發表:55 回覆:267 積分:94 註冊:2002-06-08 發送簡訊給我 |
|
小蚊子
中階會員 ![]() ![]() ![]() 發表:55 回覆:267 積分:94 註冊:2002-06-08 發送簡訊給我 |
v := FieldByName(s); ADODataSet_1.FieldByName(s).Value := v; 改為 v := FieldByName(s).AsVariant; ADODataSet_1.FieldByName(s).AsVariant := v; 也可以運作了 謝謝您 ===================引 用 eaglewolf 文 章=================== 若改成底下這樣,不可以嗎? [code delphi] var i , nREC : integer; s: string; v: variant; sRecFields , sTmp: string; begin with ADODataSet_2 do begin first; nRec :=0; while not Eof do begin ADODataSet_1.Insert; for i := 0 to FieldCount - 1 do begin s := Fields[i].FieldName; v := FieldByName(s); ADODataSet_1.FieldByName(s).Value := v; end; ADODataSet_1.Post; Next; end; END; end; [/code] |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |