I have an Windows forms application written in VB.NET that uses a SQL Server
2000 back end database with Windows authentication. There is no problem
accessing the database from my application, or from an installed version of
the application on another machine. My problem is that I would like to
access the database overnight unattended to perform some maintenance tasks.
With my fairly limited knowledge of SQL Server and VB.NET, I thought that
the best way to do this would be using a windows service with a timer, so
that it could be running all the time while windows is running and the timer
could perform the maintenance at the correct time. I created a new Windows
Service project and added a reference to the same data access .dll that my
main application uses. The service installs and starts OK, and I can use the
methods in the external .dll, but whenever I try to access the database, I
get the error message 'Login failed for user 'DOMAIN2K\STAT28$'. The server,
running Windows 2000 Server, is DOMAIN2K, and my username is STAT28 which is
an Administrator on DOMAIN2K. My questions are 1) Is a windows service the
best way to do this? and 2) Why am I getting a login error using the same
data access functions that work fine in the main application? Thanks in
advance.
Andy Baker