1 (edited by stelios91 2017-08-14 05:19:50)

Topic: Performance serious problem

I inserted in my database the login with different priviledge functionality found here: http://myvisualdatabase.com/forum/viewtopic.php?id=1422

and by that time my database has a serious problem , when i close the exe the database stays open in the task manager and if you open it for example 5 times it leaves open 5 tasks. I cannot have other people using it like this. What should i do?
Password login works great.

Post's attachments

Attachment icon New Bitmap Image.bmp 1.13 mb, 482 downloads since 2017-08-14 

Re: Performance serious problem

And a script problem

Domebil

Re: Performance serious problem

domebil wrote:

And a script problem

i got the exact same script and changed the form names. its exactly original as in the link. it doesnt happen in the original only on mine

Re: Performance serious problem

Also i saw that my password is not marked with * but instead shows the characters hmm 
i cant seem to find what im doing wrong , i changed everything that should be changed.

var
   sUser: string = '';



procedure frmLogin_OnShow (Sender: string; Action: string);
begin
     frmLogin.edPassword.PasswordChar := '*';
     frmLogin.bLogin.Default:=True;
end;

procedure Base_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close
end;


                           



procedure frmLogin_bLogin_OnClick (Sender: string; var Cancel: boolean);
var
   s: string;
begin
     // SQL query for check user and password
     s := VarToStr( SQLExecute('SELECT count(id) FROM users WHERE (login = ''' + frmLogin.edUser.Text + ''') AND (password = ''' + frmLogin.edPassword.Text + ''');') );

     // if SQL query found login and password
     if (s <> '0') and (s<>'') then
     begin
          sUser := frmLogin.edUser.Text; // remember username

          // check admin rights
          s := VarToStr( SQLExecute('SELECT administrator FROM users WHERE (login = ''' + sUser + ''');') );
          if s='0' then Base.bUsers.Enabled := False; // if the user does not have administrator privileges, deactivate the button to create other users

          // check permissions to read
          s := VarToStr( SQLExecute('SELECT read FROM users WHERE (login = ''' + sUser + ''');') );
          if s='0' then Base.edit.Enabled := False; // deactivate the button to edit the record

          // check write permissions
          s := VarToStr( SQLExecute('SELECT write FROM users WHERE (login = ''' + sUser + ''');') );
          if s='0' then
          begin
               Base.New.Enabled := False;      // deactivate the button to add the record
               CharacterSheet.Save.Enabled := False; // deactivate the button to save the record
               ActivityLog.save.Enabled := False;
               Connections.save.Enabled := False;
          end;

          // check permission to delete
          s := VarToStr( SQLExecute('SELECT remove FROM users WHERE (login = ''' + sUser + ''');') );
          if s='0' then Base.delete.Enabled := False; // deactivate the button to delete the record

          // check permission to search
          s := VarToStr( SQLExecute('SELECT search FROM users WHERE (login = ''' + sUser + ''');') );
          if s='0' then base.search.Enabled := False; // deactivate the button to search the records


          frmLogin.Hide; // close login form
          Base.Show;
     end else MessageDlg('password is incorrect', mtError, mbOk, 0); // message if the password is incorrect

end;






begin
  // Initial check whether there is a database administrator user
  // if not, create an administrator with username admin and password admin
     if VarToStr( SQLExecute('SELECT count(id) FROM users WHERE administrator=1;') ) = '0' then
     begin
         SQLExecute('INSERT INTO users (login, password, read, write, remove, search, administrator) VALUES ("admin", "admin", 1, 1, 1, 1, 1);');
         frmLogin.edUser.Text := 'admin';
         frmLogin.edPassword.Text := 'admin';
     end;

end.

Re: Performance serious problem

my database has a serious problem , when i close the exe the database stays open in the task manager and if you open it for example 5 times it leaves open 5 tasks. I cannot have other people using it like this. What should i do?



please look at this:

procedure Form1_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close
end;

I suppose that you have main form frmLogin which hided after login, but application will be in the memory until main form not be close. You must close main form manually using script when your general form of app close.

Dmitry.

Re: Performance serious problem

Also i saw that my password is not marked with * but instead shows the characters

Component TextBox have property PasswordChar, set its value =  *

Dmitry.

7 (edited by stelios91 2017-08-14 15:02:57)

Re: Performance serious problem

DriveSoft wrote:

my database has a serious problem , when i close the exe the database stays open in the task manager and if you open it for example 5 times it leaves open 5 tasks. I cannot have other people using it like this. What should i do?



please look at this:

procedure Form1_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close
end;

I suppose that you have main form frmLogin which hided after login, but application will be in the memory until main form not be close. You must close main form manually using script when your general form of app close.

I changed this value to the mane of my form that i want to be closing :

procedure Base_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close
end;

When i close my Base for the login page closes aswell but still not working hmm what am i missing

"You must close main form manually using script when your general form of app close."

what do you mean? big_smile sorry i am bad at english if you mean change the form name i did

Re: Performance serious problem

Hello stelios91

Get into the habit of completing a Delphi instruction by one ;

procedure Form1_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close;
end;


JB

Re: Performance serious problem

jean.brezhonek wrote:

Hello stelios91

Get into the habit of completing a Delphi instruction by one ;

procedure Form1_OnClose (Sender: string; Action: string);
begin
    frmLogin.Close;
end;


JB

well i tried to close the command as you mentioned and did not give the wanted result , still doing the same , process not closed on form close ,
And the other thing is that its the exact same script from the original and it closes the form without having ;

Re: Performance serious problem

I think you need to attach your project so we can determine what is going on. Otherwise it's just a guessing game on everybody's part.

Re: Performance serious problem

Here is the project. Thanks a lot, dont worry about the greek characters just see the issue on the script if you can :>

Post's attachments

Attachment icon Infolog.rar 852.15 kb, 384 downloads since 2017-08-14 

Re: Performance serious problem

It's fixed.  See attached.


https://s21.postimg.org/ohwxcg0x3/Base_On_Close.png

Post's attachments

Attachment icon Infolog Fixed.zip 1.65 mb, 466 downloads since 2017-08-14 

Re: Performance serious problem

ehwagner wrote:

It's fixed.  See attached.


https://s21.postimg.org/ohwxcg0x3/Base_On_Close.png

thank you so much <3
you really saved me big_smile