with AAdq do begin SQL.Text:='INSERT INTO 需要做的事(選中,ID,類別,標題,優先級,狀態,已完成百分比,說明,開始日期,截止日期,附件)VALUES(:選中,:ID,:類別,:標題,:優先級,:狀態,:已完成百分比,:說明,:開始日期,:截止日期,:附件) '; Parameters.ParamByName('選中').Value:=AXuYaoArray[0]; Parameters.ParamByName('ID').Value:= AXuYaoArray[1]; Parameters.ParamByName('類別').Value:= AXuYaoArray[2]; Parameters.ParamByName('標題').Value:= AXuYaoArray[3]; Parameters.ParamByName('優先級').Value:= AXuYaoArray[4]; Parameters.ParamByName('狀態').Value:= AXuYaoArray[5]; Parameters.ParamByName('已完成百分比').Value:= AXuYaoArray[6]; Parameters.ParamByName('說明').Value:= AXuYaoArray[7]; Parameters.ParamByName('開始日期').Value:= AXuYaoArray[8]; Parameters.ParamByName('截止日期').Value:= AXuYaoArray[9]; Parameters.ParamByName('附件').Value:= AXuYaoArray[10]; ExecSQL; end;
以前都是這么用的,可是今天卻一直提示ParameterID not found,把Parameters.ParamByName(ID’).Value := getid();這句注釋掉后,就提示后邊的參數沒有找到。
有人說values后要加空格,加了不行。重新寫一遍,看是不是輸入漢字字符了?試了各種方法,還是沒解決問題.
后來看到有高人總結了三種原因 :
出現 ADOQuery1 : parameter "***r" not found 的提示的原因:
1、SQL語句本身無參數;
2、ADOQuery1的ParamCheck屬性為False;
3、未設置ADOQuery1的Connection或ConnectionString屬性。
4、數據類型為ID自動增加,或者日期格式造成的;
仔細一檢查,第三條。果斷取改 。
參考原文:http://blog.csdn.net/hank5658/article/details/3238180
參考原文2:https://wenku.baidu.com/view/98afdefa770bf78a65295489.html