0

I've created a windows forms application that would use a client server model for accessing database. I created a connection for Entity Framework Model and it works fine with the following connection string:

connectionString="metadata=res://*/CartonOrderModel.csdl|
                           res://*/CartonOrderModel.ssdl|
                           res://*/CartonOrderModel.msl;
                  provider=System.Data.SqlClient;
                  provider connection string="
                  Data Source=.\SQLEXPRESS;
                  AttachDbFilename=E:\Databases\RollMeasurements.mdf;
                  Integrated Security=True;
                  Connect Timeout=30;
                  User Instance=True;
                  MultipleActiveResultSets=True""
providerName="System.Data.EntityClient"

I wonder if this connection string would still work when i deploy it on client environment which has a central db server and more than one instance of my app would be accessing it from client machines.

I tried changing the connection string to this:

connectionString="metadata=res://*/CartonOrderModel.csdl|
                           res://*/CartonOrderModel.ssdl|
                           res://*/CartonOrderModel.msl;
                  provider=System.Data.SqlClient;
                  provider connection string="
                  Data Source=.\SQLEXPRESS;
                  Initial Catalog=RollMeasurements;
                  User ID=sa;
                  Password=sapassword;
                  Connect Timeout=30;
                  User Instance=True;
                  MultipleActiveResultSets=True""
providerName="System.Data.EntityClient"

But now when I run my app it gives me this exception:

Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.

Please help me with this. Thanks!

2 Answers 2

2

I think you have to remove User Instance=True (or set it to False explicitely). User Instances are local copies of a SQL Express database and not suited for work in a multiuser environment with a central DB.

Sign up to request clarification or add additional context in comments.

Comments

0

I think if you want to access to a central server, you need to change the Data Source=.\SQLEXPRESS; line to a central sql server instance.

english is not my mother language so maybe dont understand correctly the question.

Cheers

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.