Delphi access to MySQL server time problem

Form1.MyQuery1.SQL.Clear;
Form1.MyQuery1.SQL.Add('SELECT TIMESTAMPDIFF(SECOND, now(), '2013-12-01 22:50:25')');
try
Form1.MyQuery1.Execute;
timediff:= //How to make a query results into timediff?
except
form1.Memo2.Lines.Add('Query the server time error!');
end;

Time_ser is recording the time read from the database.

Thank you.

Started by Roderick at February 04, 2016 - 10:00 AM

begin
Form1.MyQuery1.SQL.Clear;
Form1.MyQuery1.SQL.Add('select `time` from `monitor_system`.`666master_pridata` order by `number` desc limit 1');
try
Form1.MyQuery1.Execute;
time_ser:= Form1.MyQuery1.FieldByName('time').AsString;
except
form1.Memo2.Lines.Add('Query the database time error!');
end;

Form1.MyQuery1.SQL.Clear;
Form1.MyQuery1.SQL.Add('SELECT TIMESTAMPDIFF(SECOND, now(), time_ser)');
try
Form1.MyQuery1.Execute;
timediff:= Form1.MyQuery1//????
except
form1.Memo2.Lines.Add('Query the server time error!');
end;

end;

Posted by Roderick at February 14, 2016 - 10:10 AM

Form1.MyQuery1.SQL.Clear;
s:= 'SELECT TIMESTAMPDIFF(SECOND, now(), '''+time_ser+''') as time1';
Form1.MyQuery1.SQL.Add(s);

try
Form1.MyQuery1.Execute;
timediff:= Form1.MyQuery1.fieldbyname('time1').AsString;
except
form1.Memo2.Lines.Add('Query the server time error!');
end;
Result:= timediff;

Ha ha, solve their own, ha ha, let you laugh at me.

Posted by Roderick at January 01, 2017 - 8:42 AM


Is not connected to individuals.. Ha-ha

Posted by Victoria at January 01, 2017 - 9:35 AM

Access points!! Access points!!!

Posted by Estelle at January 07, 2017 - 9:01 AM