Connecting to a database with user and password lazarus / 16-Databases ---------------------------------------------------------------------- yordan · 2011-01-03 10:23 Hi, I'm trying the following code: procedure TForm1.FormShow(Sender: TObject);    var user: string;     pass: string; begin  // user:='-1' ;   showmessage(user);   mysql50connection1.HostName:=Application.GetOptionValue('h','host');   mysql50connection1.DatabaseName:=Application.GetOptionValue('d','db');   mysql50connection1.UserName:=Application.GetOptionValue('u','user');   mysql50connection1.Password:=Application.GetOptionValue('p','pass');   mysql50connection1.port:=strtoint(Application.GetOptionValue('o','po rt'));   pass:=Application.GetOptionValue('l','passw');   user:=Application.GetOptionValue('k','kod');   mysql50connection1.Open;   showmessage(user);   if user='' then application.Terminate;   sqlquery4.SQL.Text:= 'select kod from users where kod='+user+' and passw=md5('''+pass+''')';  // showmessage(sqlquery4.sql.text);   sqlquery4.Open;   if sqlquery4.RecordCount=0 then application.Terminate; end;                    The problem is that when I run the .exe file without user name and password instead of  terminating the application  I see the empty string variable user(as it's supposed to be) then I get the message:  "" is an illegal integer and when i press OK I am able to enter the table without entering user name and password as run parameters. Can you tell me how to fix this.  Thanks ---------------------------------------------------------------------- eny · 2011-01-03 10:29 Maybe 'user' contains whitespace characters? You could try this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //...user := trim(Application.GetOptionValue('k','kod'));//... <> I assume you'll have to 'escape' the user part in the select statement as well (as you've done with the password). ---------------------------------------------------------------------- yordan · 2011-01-03 10:54 the problem was in : mysql50connection1.port:=strtoint(Application.Get OptionValue('o','port')); I replaced that line : if Application.GetOptionValue('o','port')<>'' then mysql50connection1.port:=strtoint(Application.GetOptionValue('o', 'port')) and it works OK