A couple of ideas.

First, avoid macros and variables in strings, it will bite you later:
Code:
$retcode = DBExecuteSQL($objConn,"INSERT INTO software (Sid, Workstation, Application, Version, Publisher, Path, DateTime) VALUES('', '"+@wksta+"', '', '', '', '', '"+$DateTime+"')")



Second, and more likely, have you sanitised the data? If @WKSTA is returng a value like "T Hoek's PC" it is going to break your SQL statement because of the single quote character.

Similarly other characters may cause a problem, especially when you start recording application names and so-on.