Tquery的Table is read only 的問題 |
尚未結案
|
chkkevin
一般會員 發表:34 回覆:64 積分:19 註冊:2007-05-17 發送簡訊給我 |
小弟想使用一個Tmemo寫下update SQL,update 資料
但出現”Table is read only ” error message. 為什麼呢? coding 如下: procedure TForm1.Button3Click(Sender: TObject); begin Query2.Close; Query2.SQL.Clear; Query2.SQL.Text:=Memo1.Text;//內裡寫下Update staff set Apply_date='2006-02-25', PassNo='L659878' where Staff_ID='S000000002' Query2.ExecSQL; Query2.Close; Query2.open; end;
------
獨學無友則孤陋寡聞,相識滿天下能知天下事 小弟是來自香港的~~多多指教 編輯記錄
chkkevin 重新編輯於 2008-01-20 12:16:23, 註解 無‧
|
yubad2000
中階會員 發表:0 回覆:44 積分:78 註冊:2007-09-30 發送簡訊給我 |
I think the "Query2.open" might be the cause of this error since you can not open a query with a update SQL.
===================引 用 chkkevin 文 章=================== 小弟想使用一個Tmemo寫下update SQL,update 資料 但出現”Table is read only ” error message. 為什麼呢? coding 如下: procedure TForm1.Button3Click(Sender: TObject); begin Query2.Close; Query2.SQL.Clear; Query2.SQL.Text:=Memo1.Text;//內裡寫下Update staff set Apply_date='2006-02-25', PassNo='L659878' where Staff_ID='S000000002' Query2.ExecSQL; Query2.Close; Query2.open; <<=======This might be the problem=== end;
------
===波士頓夜未眠=== What a wonderful world!! Jazz up the world with jazz!! ================== When I am not programming... you can find me here: http://www.holy-war.de/EN/World3/bin/?advertiser=63190 |
GrandRURU
站務副站長 發表:240 回覆:1680 積分:1874 註冊:2005-06-21 發送簡訊給我 |
不太清楚delphi的語法,把c++的方式套進去,有錯誤還煩請指正。
[code delphi] procedure TForm1.Button3Click(Sender: TObject); begin Query2.Close; Query2.Edit; //←好像要先加這行?試試看唄 Query2.SQL.Clear; Query2.SQL.Text:=Memo1.Text;//內裡寫下Update staff set Apply_date='2006-02-25', PassNo='L659878' where Staff_ID='S000000002' Query2.ExecSQL; Query2.Close; //←這兩行是不是多出來了呢? Query2.open; // end; [/code] ===================引 用 chkkevin 文 章=================== 小弟想使用一個Tmemo寫下update SQL,update 資料 但出現”Table is read only ” error message. 為什麼呢? coding 如下: [code delphi] procedure TForm1.Button3Click(Sender: TObject); begin Query2.Close; Query2.SQL.Clear; Query2.SQL.Text:=Memo1.Text;//內裡寫下Update staff set Apply_date='2006-02-25', PassNo='L659878' where Staff_ID='S000000002' Query2.ExecSQL; Query2.Close; Query2.open; end; [/code]
編輯記錄
GrandRURU 重新編輯於 2008-01-22 11:43:30, 註解 無‧
|
st33chen
尊榮會員 發表:15 回覆:591 積分:1201 註冊:2005-09-30 發送簡訊給我 |
在Query2.ExecSQL;
Query2.Close; 及 Query2.open; 之間 加入一個 select 的 sql statement, 例 : Query2.ExecSQL; Query2.Close; query2.sql.text := 'select * from staff where Staff_ID='S000000002'; Query2.open;
------
IS IT WHAT IT IS 我是 李慕白 請倒著唸. 又想把老話拿出來說, 請用台語發音 : 專家專家全是ROBOT CAR (滷肉腳啦); 都已接手這麼久了, 績效還是那麼爛, 講話還那麼大聲. |
nisson
一般會員 發表:2 回覆:12 積分:22 註冊:2008-01-31 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |