Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-11

Error: Can't take the address of constant expressions

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Osvaldo Filho
On Windows XP
With lazarus 0.9.28.3 and fpc 2.2.4 i do not have this error;

But with 0.9.29 and 2.3.1 i have!

Any idea?

==========================
C:\componentes\UserControl\package\lazarus\UCBase.pas(1180,68) Error: Can't take the address of constant expressions

function TUserControl.AddUser(Login, Password, _Name, Mail: String;
  Profile: Integer; PrivUser: Boolean) : Integer;
var
  Key : String;
begin

with DataConnector.UCGetSQLDataset('Select
Max('+TableUsers.FieldUserID+') as IdUser from ' + TableUsers.TableName) do

  begin
    if FieldByName('idUser').AsString = '' then Result := 1
    else Result := Fieldbyname('idUser').AsInteger + 1;
    Close;
    Free;
  end;
  Key := Encrypt( IntToStr(Result)+Login+Password, EncryptKey );
  with TableUsers do

DataConnector.UCExecSQL(Format('Insert into %s( %s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES(%d, %s, %s, %s, %s, %s, %d, %s, %s)',

[ TableName,

FieldUserID, FieldUserName, FieldLogin, FieldPassword, FieldEmail, FieldPrivileged, FieldProfile, FieldTypeRec, FieldKey,

Result, QuotedStr(Name), QuotedStr(Login),
QuotedStr(Encrypt(Password, EncryptKey)),

                QuotedStr(Mail), BoolToStr(PrivUser), Profile,
QuotedStr('U'), QuotedStr(Key)]));
  if Assigned(OnAddUser) then OnAddUser(Self, Login, Password, Name,
Mail, Profile, Privuser);
end;

=======================================================

unit UCBase;
{$mode DELPHI}

{.$mode objfpc}{$H+}

interface

uses

LCLIntf, LResources, UCDataInfo, SysUtils, Classes, Menus, ActnList,

   UCMessages, Controls, UCConsts, Graphics, DB, Forms;

Reply by email