執行時發生錯誤的原因? |
缺席
|
terrenceman
一般會員 發表:7 回覆:7 積分:2 註冊:2007-01-05 發送簡訊給我 |
請各位大大幫我看看:
這是我在BCB中其中一個按鈕中的指令,當我編議程執行檔時,也都沒問題,可是當我執行時,點下此按鈕 卻告訴我說:『 Parameter ' TTNumber ' not found ! 』。請問這是什麼原因呢? 我找了好久都找不到那裡有問題~~ 請各位幫我想想看,感恩啦~~~ void __fastcall TForm1::Button15Click(TObject *Sender) { TDateTime dt2 = Now(); ADOQuery1->Close(); ADOQuery1->SQL->Clear(); ADOQuery1->SQL->Add("UPDATE LineandFormulaandComment SET Line=SELine, Formula=SEFormula, Comment=SEComment, I=SEI, Date=SEDate, RGB100=SERGB100,"); ADOQuery1->SQL->Add("RGB010=SERGB010, RGB001=SERGB001, RGB111=SERGB111, RGB211=SERGB211, RGB121=SERGB121, RGB112=SERGB112 WHERE Number=TTNumber"); ADOQuery1->Parameters->ParamByName("TTNumber")->Value=StrToInt(StringGrid2->Cells[12][Row_Set_of_StringGrid2]); ADOQuery1->Parameters->ParamByName("SELine")->Value=ComboBox1->Text; ADOQuery1->Parameters->ParamByName("SEFormula")->Value=ComboBox2->Text; ADOQuery1->Parameters->ParamByName("SEComment")->Value=Memo1->Text; ADOQuery1->Parameters->ParamByName("SEI")->Value=ComboBox3->Text; ADOQuery1->Parameters->ParamByName("SEDate")->Value=dt2; ADOQuery1->Parameters->ParamByName("SERGB100")->Value=Edit1->Text; ADOQuery1->Parameters->ParamByName("SERGB010")->Value=Edit2->Text; ADOQuery1->Parameters->ParamByName("SERGB001")->Value=Edit3->Text; ADOQuery1->Parameters->ParamByName("SERGB111")->Value=Edit4->Text; ADOQuery1->Parameters->ParamByName("SERGB211")->Value=Edit5->Text; ADOQuery1->Parameters->ParamByName("SERGB121")->Value=Edit6->Text; ADOQuery1->Parameters->ParamByName("SERGB112")->Value=Edit7->Text; ADOQuery1->ExecSQL(); } |
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
不只一個吧!你的程式碼哪裡參考來的?沒用過動態參數嗎?參考一下下面改的地方,每一個變數前面都要加上冒號(:)
===================引 用 terrenceman 文 章=================== 請各位大大幫我看看: 這是我在BCB中其中一個按鈕中的指令,當我編議程執行檔時,也都沒問題,可是當我執行時,點下此按鈕 卻告訴我說:『 Parameter ' TTNumber' not found ! 』。請問這是什麼原因呢? 我找了好久都找不到那裡有問題~~ 請各位幫我想想看,感恩啦~~~ void __fastcall TForm1::Button15Click(TObject *Sender) { TDateTime dt2 = Now(); ADOQuery1->Close(); ADOQuery1->SQL->Clear(); ADOQuery1->SQL->Add("UPDATE LineandFormulaandComment SET Line=:SELine, Formula=:SEFormula, Comment=:SEComment, I=:SEI, Date=:SEDate, RGB100=:SERGB100,"); ADOQuery1->SQL->Add("RGB010=:SERGB010, RGB001=:SERGB001, RGB111=:SERGB111, RGB211=:SERGB211, RGB121=:SERGB121, RGB112=:SERGB112 WHERE Number=:TTNumber"); ADOQuery1->Parameters->ParamByName("TTNumber")->Value=StrToInt(StringGrid2->Cells[12][Row_Set_of_StringGrid2]); ADOQuery1->Parameters->ParamByName("SELine")->Value=ComboBox1->Text; ADOQuery1->Parameters->ParamByName("SEFormula")->Value=ComboBox2->Text; ADOQuery1->Parameters->ParamByName("SEComment")->Value=Memo1->Text; ADOQuery1->Parameters->ParamByName("SEI")->Value=ComboBox3->Text; ADOQuery1->Parameters->ParamByName("SEDate")->Value=dt2; ADOQuery1->Parameters->ParamByName("SERGB100")->Value=Edit1->Text; ADOQuery1->Parameters->ParamByName("SERGB010")->Value=Edit2->Text; ADOQuery1->Parameters->ParamByName("SERGB001")->Value=Edit3->Text; ADOQuery1->Parameters->ParamByName("SERGB111")->Value=Edit4->Text; ADOQuery1->Parameters->ParamByName("SERGB211")->Value=Edit5->Text; ADOQuery1->Parameters->ParamByName("SERGB121")->Value=Edit6->Text; ADOQuery1->Parameters->ParamByName("SERGB112")->Value=Edit7->Text; ADOQuery1->ExecSQL(); } |
terrenceman
一般會員 發表:7 回覆:7 積分:2 註冊:2007-01-05 發送簡訊給我 |
|
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |