I have been reading Expert C# 2008 Business Objects and am trying to run the PTWebForms example on my laptop. The website will start up, but the first time it tries to access the DataPortal, I get the following error:
System.Data.SqlClient.SqlException was unhandled
Message=Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
Source=.Net SqlClient Data Provider
I have been searching the book, forums, and google, but have not found the solution. I created a very simple application that can access the ProjectTracker.DalLinq directly, but I cannot access it through the DataPortal.
Environment:
Looks like you are using SQL Express feature to attach a DB to an instance. To isolate, you might want to correct your connection string and just attach DB to an SQL Server instance. I am guessing either you do not have Express installed or something wrong with DB.
Thanks for pointing me to the connection string. I am not sure why but changing User Instance=True to User Instance=False seems to have fixed the issue. I think you are right too about moving it to SQL Server instead of SQL Express. I was just starting with the downloaded example files.
Before:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Visual Studio Projects\csla\Samples\CslaNet\cs\ProjectTrackercs\PTracker.mdf";Integrated Security=True;User Instance=True
After:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Visual Studio Projects\csla\Samples\CslaNet\cs\ProjectTrackercs\PTracker.mdf";Integrated Security=True;User Instance=False
Copyright (c) Marimer LLC