I have two
VB 2005 applications, one is a Windows Service and the other is a forms-based application. Both connect to the same SQL Server Express 2005 database.
Each program will successfully connect to the database if started by itself, but both will not connect simultaneously. If I copy the code from the service in to a forms-app then they both will connect simultaneously. The problem is when one program is a forms-based application and the other is a service.
The connection strings for both applications are the same:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\SmartTall yDE.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True
The error message that I get when the service fails to connect when the other application is running is:
Service cannot be started. System.Data.SqlClient.SqlException: Cannot open database "C:\SMARTTALLYDE.MDF" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
As I said before both programs work by themselves, and if both are a forms-based application they can both connect simultaneously. The problem is that they cannot connect when one is a forms-based app and the other is a service.
Any ideas? Thanks in advance.