Wolfgan 17 Junior Poster

You misunderstand basis. Any program itself contains a message loop. At your service, it is not. When you start your service, it starts a thread. More service, do nothing, nor any instructions there for this reason it completes its work. On this you and inform.
In order for service has not ended, you need to implement event implementation. See the attached example. Just pay attention that the cycle is better to check the property Terminated. This property is true when the service portebuetsya completion. Otherwise you risk to be able to stop him. This also applies to Thread.
Implementation of SQL in the cycle seems unlikely. Obviously you need a single execution of this command. Consequently, the team should be run at the coming of the events (eg onset of a certain time). Therefore, one should check in the loop is not the right time has come. If the time has come - the command (it is quite possible to run n

pritaeas commented: Good examples +14
Wolfgan 17 Junior Poster

Where is the question?

Wolfgan 17 Junior Poster
function IntToBin( Value: integer; Digits: integer ): string;
begin
  result := StringOfChar ( '0', digits ) ;
    while value > 0 do begin
      if (value and 1) = 1 then
        result[digits] := '1';
      dec (digits) ;
      value := value shr 1;
    end;
end;
november_pooh commented: Thx.. :) +3
Wolfgan 17 Junior Poster

It's very simple. Use components Indy (TIdHttp) http://www.delphigroups.info/2/5/487672.html

or http://www.realthinclient.com/ (TrtcHttpClient)