Windows Service: Command Text property has not been initialized

Posted on Posted in Microsoft, Window Service

Windows Service: Command Text property has not been initialized

When calling a SQL query in Windows service might throw an error

Command Text property has not been initialized

Usually this error is that Windows Service can’t find SQL query code. If you are calling from an external file then make sure you copy .sql file in the same folder where Windows Service code is located.