ADOQuery1.Delete 為什麼無法執行? 請問語法有錯誤嗎? |
尚未結案
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
請問下面的程式是否有問題? 為什麼執行會有錯誤? procedure TForm1.SpeedButton7Click(Sender: TObject);
var
Emp_No: String;
begin
Emp_No := DataSource1.DataSet.FieldByName('A0').AsString;
if messagedlg('確定要刪除?',mtConfirmation,[mbYes, mbNo], 0) = mrYes then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text := 'SELECT * FROM pm3d Where (A0 = ' QuotedStr(Emp_No) ')';
ADOQuery1.Delete;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from pm3d');
ADOQuery1.Open;
end;
end;
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
錯誤訊息如下:
Project MDIAPP.exe raised exception class EDatabaseError with message'ADOQuery1:Cannot perform this operation on a closed dataset' Process stopped. Use Step or Run to continue. 如果繼續執行就會出現
ADOQuery1: Cannot perform this operation on a closed dataset.
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
改成這樣也不行吔,真奇怪
procedure TForm1.SpeedButton7Click(Sender: TObject);
var
Emp_No: String;
begin
Emp_No := DataSource1.DataSet.FieldByName('A0').AsString;
if messagedlg('確定要刪除?',mtConfirmation,[mbYes, mbNo], 0) = mrYes then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text := 'DELETE FROM pm3d Where (A0 = ' QuotedStr(Emp_No) ')';
ADOQuery1.ExecSQL;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from pm3d');
ADOQuery1.Open;
end;
end; 執行到 ADOQuery1.ExecSQL; 就會出現錯誤訊息 Access violation at address 1F453E7E in module 'msado15.dll'. Write of address 00FDB020. 發表人 - jawtair 於 2003/06/06 19:26:29
|
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
hagar
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
procedure TForm1.SpeedButton7Click(Sender: TObject); var Emp_No: String; begin Emp_No := DataSource1.DataSet.FieldByName('A0').AsString; if messagedlg('確定要刪除?',mtConfirmation,[mbYes, mbNo], 0) = mrYes then begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Text := 'SELECT * FROM pm3d Where (A0 = '+ QuotedStr(Emp_No) +')';ADOQuery1.Open; // 這加一行後, 再做 ADOQuery1.Delete 的動作 ADOQuery1.Delete; ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from pm3d'); ADOQuery1.Open; end; end;[/quote] --- 每個人都是一本書 |
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
引言: 改成這樣試看看 ADOQuery1.SQL.Text := 'DELETE FROM pm3d Where (A0 = ' #39 QuotedStr(Emp_No) #39 ')'; 執行到 ADOQuery1.ExecSQL; 就會出現錯誤訊息 Project MDIAPP.exe raised exception class EAccessViolation with message'Access violation at address 1F453E7E in module 'msado15.dll'. Write of address 00FEF024'. Process stopped. Use Step or Run to continue. 如果繼續執行就會出現 Access violation at address 1F453E7E in module 'msado15.dll'. Write of address 00FEF024. 我想問題可能不在DELETE語法,而是ADOQuery1屬性,是否唯讀,還是資料庫鎖住了 順便說一下我的元件結構 SQL數據庫pm3d←ADOConnection1←ADOQuery1←DataSource1←DBGrid1 |
hagar
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
引言:改成下面這樣後,仍然不行 procedure TForm1.SpeedButton7Click(Sender: TObject); var Emp_No: String; begin Emp_No := DataSource1.DataSet.FieldByName('A0').AsString; if messagedlg('確定要刪除?',mtConfirmation,[mbYes, mbNo], 0) = mrYes then begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Text := 'SELECT * FROM pm3d Where (A0 = '+#39+ QuotedStr(Emp_No) +#39+')'; ADOQuery1.Open; ADOQuery1.Delete; ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from pm3d'); ADOQuery1.Open; end; end; 執行時,出現錯誤訊息ADOQuery1.Open; // 這加一行後, 再做 ADOQuery1.Delete 的動作 |
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
引言: 如hagar大大所說不之你有沒有做過Update ADO 了?有啊,就是照hagar版主改成 procedure TForm1.SpeedButton7Click(Sender: TObject); var Emp_No: String; begin Emp_No := DataSource1.DataSet.FieldByName('A0').AsString; if messagedlg('確定要刪除?',mtConfirmation,[mbYes, mbNo], 0) = mrYes then begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Text := 'SELECT * FROM pm3d Where (A0 = ' #39 QuotedStr(Emp_No) #39 ')'; ADOQuery1.Open; <-------------- 執行到這一行,會有問題! ADOQuery1.Delete; ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from pm3d'); ADOQuery1.Open; end; end; 錯誤訊息同我所上傳的圖 |
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
ha0009
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:16 回覆:507 積分:639 註冊:2002-03-16 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
誰能救救我,我已經浪費許多時間,但無搞定:-( 我已經註冊了,且也收到激活的網址,信件內容如下:
Hello, Wang Chao-Tai Thank you for joining the Borland Community! This message is being sent to wang.chaotai@msa.hinet.net.
Please do not reply directly to this message. You are being sent this email message because you have not yet
activated the Borland Community account you created on
Fri Jun 6 20:10:34 PDT 2003. Here is the login name you provided to our login system: Login Name: "jawtair" To activate your community membership, please open the following
location in your web browser: https://bdn.borland.com/cgi-bin/login/activate.cgi?BG069MJI1CCFJ9 This URL is specific to YOUR user account. Do not provide it to
anyone else, or post it to the public in our newsgroups. Once you open that location in your browser, your account will
be activated and you will have full access to the Borland
Community Site at http://community.borland.com This activation code is for your community membership only. It is
not used for any evaluation products you may also have downloaded.
If you have any problems with your account, please direct them to
accountmgr@borland.com. If you don't remember trying to login, this is the available
information on the user who made this request: Remote Address: 61.221.92.180
User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Assistant 1.0.2.4) 但是當我要下載,輸入帳號及密碼,卻出現:
Registration record not found
Your email address was found in the database, however, no product registration was found in the database for your account. Please ensure that your username and password were entered correctly. Please enter the email address you used when you registered Delphi 6 for authorization to enter the Delphi 6 Registered Users page. 我也曾經請它 Forgot My Password! 寄給我的密碼也沒有錯啊,或是誰能告訴我如何解決這個問題,或是將DELPHI 6 ENTERPRISE版本的更新檔寄給我wang.chaotai@msa.hinet.net謝謝您的協助,我真的一籌某展了
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
|
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
引言: 這裏有講到這個問題, 是要 Update ADO 的哇! 一上來有許多更新檔,列出如下,請問是要每一個做更新嗎?會不會互相衝突? Delphi 6 Runtime Library Update 3 StarTeam Integrations Delphi 6 Runtime Library Update 2 General Update 2 CORBA Update for VisiBroker 4.1 CORBA Update for VisiBroker 3.3 dbExpress Informix 9.2.1 Driver dbExpress InterBase 6.5 Driver Additonal Updates 發表人 - jawtair 於 2003/06/07 13:47:47 |
chih
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
|
jawtair
一般會員 ![]() ![]() 發表:30 回覆:92 積分:24 註冊:2003-04-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |