Jump to content

thomh

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Hi David, Delphi service that does nothing stops also. It might have something to do with how I start the service. This is straight from the RTC demo app. Is there a more "modern" way of starting the service? function ServiceStart(const aMachine, aService: String) : Boolean; var schm, schs: SC_Handle; ss: TServiceStatus; psTemp: PChar; dwChkP: DWord; begin ss.dwCurrentState := 1; schm := OpenSCManager(PChar(aMachine), nil, SC_MANAGER_CONNECT); if (schm > 0) then begin schs := OpenService(schm, PChar(aService), SERVICE_START or SERVICE_QUERY_STATUS); if (schs > 0) then begin psTemp := nil; if (StartService(schs, 0, psTemp)) then begin if (QueryServiceStatus(schs, ss)) then begin while (SERVICE_RUNNING <> ss.dwCurrentState) do begin dwChkP := ss.dwCheckPoint; Sleep(ss.dwWaitHint); if (not QueryServiceStatus(schs, ss)) then Break; if (ss.dwCheckPoint < dwChkP) then Break; end; end; end; CloseServiceHandle(schs); end; CloseServiceHandle(schm); end; Result := SERVICE_RUNNING = ss.dwCurrentState; end;
  2. Hi, we have a bunch of customers running our Delphi coded RealThinClient server as a service in a domain controlled server environment. They have set Windows Update to check for updates but not to automatically install them. When the server does a Windows update check it happens often that our Delphi services stop responding. If we stop the services we cannot start them again until we restart the server. Something happens in a domain controlled server environment when this Windows update check is done that messes up the services. Our .Net services are not affected and keeps on running. Has anybody seen or heard of this problem and is there a solution? Thanks, Thom
  3. thomh

    TFDQuery - Query all databases on a server

    Mystery solved. With this particular SQL statement, TFDQuery returns this error message when the result set is empty. [FireDAC][Phys][MSSQL]-308. Cannot open / define command, which does not return result sets. Hint: use Execute / ExecSQL method for non-SELECT commands // Thom
  4. thomh

    TFDQuery - Query all databases on a server

    Hi haentschman, Thought TFDScript was for SQL commands like INSERT, UPDATE, etc. How would you write such a script and loop the result set using TFDScript? // Thom
  5. Hi, I have the following SQL which queries all DBs on a server: declare @SQL nvarchar(max) set @SQL = STUFF((SELECT ' UNION ALL ' + 'SELECT COUNT(DISTINCT DocNo) AS DocCount, ' + quotename(name,'''') + ' AS ClientDatabase FROM ' + quotename(name) + '.dbo.TestData WHERE Flags & 2 = 0 AND (Flags & 4 = 0 OR Flags & 128 = 128) AND Flags & 2048 = 0 AND Flags & 268435456 = 0' from sys.Databases WHERE name IN ('C003','C100','C200') FOR XML PATH(''), type).value('.','varchar(max)'),1,15,'') execute(@SQL) Using it in Microsoft SQL Server Management Studio in returns the correct result set but when I use the FireDAC TFDQuery it returns the following error on the Open command: [FireDAC][Phys][MSSQL]-308. Cannot open / define command, which does not return result sets. Hint: use Execute / ExecSQL method for non-SELECT commands Any ideas how to get this SQL statement to work in FireDAC? Thanks, Thom
×