Re: Delphi SQL problems in a Windows NT Service?


Related Articles and Replies - DelphiLand

Posted by webmaster Guido on June 30, 2004 at 17:25:28:

In Reply to: Delphi SQL problems in a Windows NT Service???? posted by Todd Jaspers - NA on June 28, 2004 at 16:42:04:

: (in a Windows NT Service...)
: I can access the database ONCE, and then when I go to access it again, it freezes up. I'm not sure why it does this.

: I am connected from the very beginning (set Active := True property in the beginning), and this is my code that I use...

: Begin
: RM_DATA.RM_DM.RM_Input.SQL.Clear;
: SQLStatement := ('UPDATE REPORT_DATA '
: + 'SET REPORT_DATA.[IN_ERROR] = 1 '
: + 'WHERE REPORT_DATA.ID= ' + IntToStr(RepID));

: ShowMessage (SQLStatement);

: RM_DATA.RM_DM.RM_Input.SQL.Text := SQLStatement;
: RM_DATA.RM_DM.RM_Input.ExecSQL;
: End;
-----------------------

Are you using a TQuery component? In that case, try to close the query before changing the SQL, like this:

Query1.Close;
// here, change the SQL:
// ...
Query1.ExecSQL;


Related Articles and Replies - DelphiLand