ExecSQL |
缺席
|
bottle
一般會員 發表:16 回覆:6 積分:4 註冊:2004-10-10 發送簡訊給我 |
各位大大好…
我寫了一支簡單的程式如下:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString theName="Hinet",searchhttp="www.hinet.net";
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
Form1->ADOQuery1->SQL->Add("Insert into FirstTemp Values ('" theName "','" searchhttp "')");
ADOQuery1->Prepared=true;
ADOQuery1->ExecSQL();
}
執行上沒問題,可成功加入DB中,但我把這一段程式碼放到另一個較複雜的程式中時,則DB中不會出現資料,但也沒錯誤訊息,所以我用以下方法測試了一下… Form1->ADOQuery1->Close(); //別名加入DB中
Form1->Memo5->Lines->Add("hello1");
Form1->ADOQuery1->SQL->Clear();
Form1->Memo5->Lines->Add("hello2");
Form1->ADOQuery1->SQL->Add("Insert into FirstTemp Values ('" theName "','" searchhttp "')");
Form1->Memo5->Lines->Add("hello3");
Form1->ADOQuery1->Prepared=true;
Form1->Memo5->Lines->Add("hello4");
Form1->ADOQuery1->ExecSQL();
Form1->Memo5->Lines->Add("hello5"); 則只會印hello1~hello4,不會印到hello5,所以我猜應該是Form1->ADOQuery1->ExecSQL();沒執行到,可是,請問是什麼原因呢?該怎麼解決?
|
supman
尊榮會員 發表:29 回覆:770 積分:924 註冊:2002-04-22 發送簡訊給我 |
|
bottle
一般會員 發表:16 回覆:6 積分:4 註冊:2004-10-10 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |