title: How to pass string parameters to an TADOQuery?
body: <p>Using Delphi 2010</p>
  
  <p>Can anyone tell me what I am doing wrong here with my code. The comments show the errors that I receive with the particular methods that I tried to pass parameters to my ADOQuery</p>
  
  <pre><code>procedure CreateAdminLogin(const APasswd: string);
  var
    qry: TADOQuery;
    //P1, P2: TParameter;
  begin
    qry := TADOQuery.Create(nil);
    try
      qry.Connection := frmDataModule.conMain;
      qry.SQL.Text := 'INSERT INTO Users (User_Id, Password) VALUES (:u, :p)';
  
      //Syntax error in INTO statement
      qry.Parameters.ParamByName('u').Value:= 'Admin';
      qry.Parameters.ParamByName('p').Value:= GetMd5(APasswd);
  
  
      //invalid variant operation
      {qry.Parameters.ParamByName('u').Value.AsString:= 'Admin';
      qry.Parameters.ParamByName('p').Value.AsString:= GetMd5(APasswd);}
  
      //invalid variant operation
      {P1:= qry.Parameters.ParamByName('u');
      P1.Value.asString:= 'Admin';
      P2:= qry.Parameters.ParamByName('p');
      P2.Value.asString:= GetMd5(APasswd);}
  
  
      qry.Prepared := True;
      qry.ExecSQL;
    finally
      qry.Free;
    end;
  
  end;
  </code></pre>
  
  <p>NOTE: GetMD5 is declared as follows</p>
  
  <pre><code>function GetMd5(const Value: String): string;
  var
    hash: MessageDigest_5.IMD5;
    fingerprint: string;
  begin
    hash := MessageDigest_5.GetMd5();
    hash.Update(Value);
    fingerprint := hash.AsString();
    Result := fingerprint;
  end;
  </code></pre>
  
  <p>Thankx</p>