CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Location
    St-Petersburg (Russia)
    Posts
    32

    ADO and NT Service

    Anyone used ADO with an NT Service?

    This code fails when I run it as a service:


    _ConnectionPtr db;
    hCreate = db.CreateInstance( __uuidof(Connection) );




    Any ideas?


  2. #2
    Join Date
    Apr 1999
    Posts
    27

    Re: ADO and NT Service

    Have you turned on OLE with:

    // Initialize OLE.
    ::CoInitialize(NULL);

    Bob



  3. #3
    Join Date
    May 1999
    Posts
    6

    Re: ADO and NT Service

    Remember that a service starts without an active user on the box, so if your service talks to a database that requires authentication (like SQL Server) you must supply a valid NT user account to the service when it starts. Go to Services and under the Startup settings for your service, set "Log On As:" to "This Account" and supply an NT user account and password that is authorized to access your database.


  4. #4
    Guest

    Re: ADO and NT Service

    Yes I hav used with NT and it works fine. Make sure you have initialized OLE by CoInitialize();
    mahesh


  5. #5
    Join Date
    May 1999
    Location
    OR, USA
    Posts
    65

    Re: ADO and NT Service

    If there are other services that your service uses (e.g. MSSQL service) then they should
    be started first. CreateService(or whatever...) takes a list of dependent services.



  6. #6
    Join Date
    May 2000
    Posts
    2

    Re: ADO and NT Service

    Can you send me the code?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured