ecostas 0 Newbie Poster

Hi. I know it must be something really stupid but I've been stuck with this problem for hours now. I have always used Zeos DBO with Delphi 5 but, as I bought Delphi 2007, I decided to turn to dbExpress. Things are starting to work but my first query with parameters is not. Initially it was an update query and I changed it to a select query in order to try something different. The problem is that one of the parameters is that I get a message as below:

'---------------------------
Debugger Exception Notification
---------------------------
Project Win2kApp.exe raised exception class EDatabaseError with message 'No value for parameter 'fim''.
---------------------------
Break Continue Help
---------------------------


I pasted the code here. Have already tried parambyname, params.paramsvalues, etc, to no avail. G_Operadora, G_Fim and G_inicio are variables with the correct types.

TIA

with SQLDataSet1 do
    begin
      if active then
        close;
      commandtype := ctQuery;
      CommandText := 'update table1 set Conciliada=false where datahora '+ 
        'between :ini and :fim and operadora=:oper'; 
      params.ParamValues['oper'] := G_Operadora;
      ParamByName('fim').AsDateTime := G_fim;
      ParamByName('ini').AsDateTime := G_inicio;
      ExecSQL(false);  
   end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.