回覆列表
  • 1 # 推薦鏤空湊一下

    ADODataSet.Close; ADODataSet.CommandText:= "Select * from Test where Code=:Code "; ADODataSet.Parameters.Clear; ADODataSet.Parameters.ParseSQL(ADODataSet.CommandText,true); ADODataSet.Parameters.ParamByName( "Code ").Value := "001 "; ADODataSet.Open;以上程式碼中,語句 ADODataSet1.Parameters.ParseSQL(ADODataSet.CommandText, true) 是關鍵程式碼。透過 ParseSQL 方法解構 ADODataSet.CommandText 的 SQL 語句,建立 ADODataSet1 新的物件引數,從而使新的查詢生效。 附:Delphi 文件中對 ParseSQL 方法的描述: ParseSQL method (TParameters): Parses an SQL statement for parameters and TParameter objects. Delphi syntax: function ParseSQL(SQL: String; DoCreate: Boolean): String; Description Call ParseSQL to parse an SQL statement for parameters. For each parameter found in the SQL statement, a TParameter object is added to the calling TParameters object using the name of the parameter in the SQL statement. SQL contains the SQL statement to parse. DoCreate indicates whether to clear all existing parameter definitions before parsing the SQL statement. ParseSQL returns a parsed version of the SQL statement specified in the SQL parameter. ADOQuery1.Parameters.ParseSQL(ADOQuery1.Text, True);

  • 中秋節和大豐收的關聯?
  • 科里斯事件是什麼意思?