Error in working code I can not find. lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- xaver13 · 2017-03-13 09:46 Hello, I am using INI file. When I debug the programCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit uStart; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, mysql56conn, sqldb, FileUtil, Forms, Controls, Graphics,  Dialogs, StdCtrls, LazLogger, IniFiles, LCLTranslator, uZadavani, uKnihovna;//LazLoggerDummy  //zaměnit pro zákaz logování type   { TFormPrihlaseni }   TFormPrihlaseni = class(TForm)    btnKonec: TButton;    EditKod: TEdit;    Label1: TLabel;    MySQLConnection1: TMySQL56Connection;    Query: TSQLQuery;    SQLTransaction1: TSQLTransaction;    procedure btnKonecClick(Sender: TObject);    procedure EditKodEditingDone(Sender: TObject);    procedure FormActivate(Sender: TObject);    procedure FormDestroy(Sender: TObject);   private    { private declarations }  public    { public declarations }  end; const  C_DB_SECTION = 'DB-INFO'; var  FormPrihlaseni: TFormPrihlaseni;  jmeno, kod: string;  priorita: integer;  stationID: string;   mySqlQuery:String;  INI: TINIFile;  DBpassword, DBlocation, DBname,DBuser: string; implementation {$R *.lfm} { TFormPrihlaseni } procedure TFormPrihlaseni.EditKodEditingDone(Sender: TObject);begin   MySQLConnection1.Open;  if MySQLConnection1.Connected then  begin    Query.Database := MySQLConnection1;    SQLTransaction1.Database := MySQLConnection1;    Debugln('Connected to server: ' + MySQLConnection1.HostName);    Query.Close;    //Prepared statement:  Query.SQL.Text := 'Select * from Operator where kod = (:KOD)';    Query.Params.ParamByName('KOD').AsString := EditKod.Text;    Query.Open;    while not Query.EOF do    begin      (* DbgOut(Query.Fields[0].AsString);      DbgOut(Query.Fields[1].AsString);      DbgOut(Query.Fields[2].AsString);      DbgOut(Query.Fields[3].AsString);      DbgOut(Query.Fields[4].AsString);      Debugln(Query.Fields[5].AsString);      *)      Debugln('ID: ', Query.FieldByName('ID').AsString,        ' Operator: ' + Query.FieldByName('Operator').AsString,        ' Kod: ' + Query.FieldByName('Kod').AsString, ' Skupina: ' +        Query.FieldByName('Skupina').AsString);      kod := Query.FieldByName('Kod').AsString;      jmeno := Query.FieldByName('Operator').AsString;      priorita := Query.FieldByName('Priorita').AsInteger;      Query.Next;      Debugln('Konec dat uživatele');    end;    Query.Close;  end;  if kod = EditKod.Text then  begin    EditKod.Text :='';    EditKod.SetFocus;    //ShowMessage('Uživatel ověřen.');    FormZadavani := TFormZadavani.Create(nil);    FormZadavani.ShowModal;    FormZadavani.Free;  end  else  begin    //ShowMessage('Uživatel neověřen.');    Query.Close;    Close;  end; end; procedure TFormPrihlaseni.btnKonecClick(Sender: TObject);begin  close;end;   procedure TFormPrihlaseni.FormActivate(Sender: TObject);begin  SetDefaultLang('cs');  //ShowMessage(GetDefaultLang);  stationID := GetEnvironmentVariable('COMPUTERNAME') + ' ' +    GetEnvironmentVariable('USERNAME');  Debugln('*** Start programu: ' + stationID);  // Create the object, specifying the the ini file that contains the settings  INI := TINIFile.Create('DMySQL.ini');  // Put reading the INI file inside a try/finally block to prevent memory leaks  try    // reading values from the INI file.    DBuser     := INI.ReadString(C_DB_SECTION, 'DBuser', '');    DBpassword := INI.ReadString(C_DB_SECTION, 'DBpassword', '');    DBlocation := INI.ReadString(C_DB_SECTION, 'DBlocation', '');    DBname     := INI.ReadString(C_DB_SECTION, 'DBname', '');  finally    // After the ini file was used it must be freed to prevent memory leaks.    INI.Free;  end;  Debugln(DBuser + ' ' + DBpassword + ' ' + DBlocation+' ' + DBname);  DBpassword := Chrtran(DBpassword, '90m7n8o4pqr1stefgh0ijklu23vwx6yzab5cd',    '6ab903d1efg8h2ijklm7nop4qrstu5v0wxyz');  ShowMessage(DBuser + ' ' + DBpassword + ' ' + DBlocation+' ' + DBname);   MySQLConnection1.HostName := DBlocation;  MySQLConnection1.UserName := DBuser;  MySQLConnection1.Password := DBpassword;  MySQLConnection1.DatabaseName := DBname;    MySQLConnection1.Transaction := SQLTransaction1;  Debugln('*** Přihlášení ' + RRRRMMDD(now));  MySQLConnection1.Open;  if MySQLConnection1.Connected then  begin    Query.Database := MySQLConnection1;    SQLTransaction1.Database := MySQLConnection1;   Query.Close;    //Prepared statement:    Query.SQL.Text := 'Select * from bezi where jmenopoc = (:JMENOPOC)';    Query.Params.ParamByName('JMENOPOC').AsString := stationID;    Query.Open;    while not Query.EOF do    begin      Query.Next;    end;    if stationID = Query.FieldByName('JMENOPOC').AsString then    begin      mySQLQuery := 'update bezi set ZACATEK=''' + RRRRMMDD(Now) + ''', BEZI = "A" WHERE JMENOPOC = '''+ stationID +'''';      //SQLTransaction1.StartTransaction;      MySQLConnection1.ExecuteDirect(mySQLQuery);      SQLTransaction1.Commit;    end    else    begin      mySQLQuery :=      'insert into bezi (ID,JMENOPOC,ZACATEK,BEZI)' +        ' values(0,''' + stationID +''' , ''' + RRRRMMDD(Now) + ''' , "A" )' ;    MySQLConnection1.ExecuteDirect(mySQLQuery);      SQLTransaction1.Commit;    end;    Query.Close;  end;  end; procedure TFormPrihlaseni.FormDestroy(Sender: TObject);begin   Query.Close;  //Prepared statement:  Query.SQL.Text := 'Select * from bezi where jmenopoc = (:JMENOPOC)';  Query.Params.ParamByName('JMENOPOC').AsString := stationID;  Query.Open;  while not Query.EOF do  begin    Query.Next;  end;  if stationID = Query.FieldByName('JMENOPOC').AsString then  begin    mySQLQuery := 'update bezi set ZACATEK=''' + RRRRMMDD(Now) + ''', BEZI = "N" WHERE JMENOPOC = '''+ stationID +'''';      //SQLTransaction1.StartTransaction;      MySQLConnection1.ExecuteDirect(mySQLQuery);      SQLTransaction1.Commit;  end;  Query.Close; end;  end.It runs but when I stop it debugging like shown on attached picture, I don't see values of DBuser, DBpassword,DBlocation ... only the DBname from ini file in DEBUG window.  All these INI values are show on show message box and code is working. When I debug it on Windows I see all values. When I wrote only a small sample  www.cvrk.com/testini.zip I can see all INI values in debug window as expected. Therefore I think that must be an error in the first snippet of code here. But I can not find it. Please have you any idea?