Hi,
I have created a codeunit whereby I am connecting to a SQL Server 2012 database. In the codeunit, I have created a function OpenConnection which contains the piece of code below:
IF ISCLEAR(ADOConnection) THEN
IF NOT CREATE(ADOConnection, FALSE, TRUE) THEN
ERROR('Cannot create ADO Connection automation variable');
ADOConnection.ConnectionString('Provider=SQLOLEDB;Data Source=SERVERNAME;Initial Catalog=REPLICATION_DEV;User ID=sa;Password=XXXXXXX;');
ADOConnection.Open;
When I run the codeunit manually, it connects to the SQL Server 2012 database correctly.
Now I want to setup job queue for the codeunit to run automatically. But after starting the job queue, it is saying that the ADOConnection cannot be created.
Have anyone of you ever encountered an issue like this and if so what are the steps to solve it.
Thanks.
Regards
Arvind
*This post is locked for comments
You cannot use Automation Variable on the server. You need to change your code to dotnet. here is an example.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,219 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156