It looks correct so far, but if it works in the analyzer I would more than guess that it is a permission problem based on the user rights assigned to the account in the open connection statement.