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','port'));
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