Last post Nov 30, 2014 01:35 PM by jotavarrichio
Nov 24, 2014 05:08 PM|jotavarrichio|LINK
I am using Server Explorer in a VS 2012 and trying to do a connection with a table in SQL Server 2012. I selected Datasource : Microsoft SQL Server Database File (SqlClient) and my DataBase name, and in Advanced Option I set User Instance = False. I've
been looking for answer in several forums but all of I have seen it didn't help me to connect my DB. The message is :
"Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. "
In Advanced Properties in Add Conection Dialog there are two options of DataSource : 1) (LocalDB)\v11.0 and 2) .\SQLEXPRESS, but none of them worked.
I'd like to connect this table just to finish a project which uses LINQ to SLQ CLASSES.
I am using Windows 8 , Visual Studio 2012 and SQL Server 2012. (it is not the EXPRESS version)
I appreciate every tip that someone could give me. I don't know what to do anymore. I'd like to solve this error just to finish my studies.
Thanks a lot.
Nov 24, 2014 05:52 PM|alvinchauhan|LINK
As per your description, it seems that you want to connect to a SQL Compact Database or a Express Database. These database types are not similar to a SQL Instance hosted on a server. If you want to connect to a local or remote INSTANCE of a SQL SERVER ENGINE
then you should select Microsoft SQL Server and not SQL Server Database file as shown below.
I hope that helped.
Nov 24, 2014 06:45 PM|jsiahaan|LINK
Addition to Alvin, this is two examples of connectionString, where "humanit3" is SQL Server computername, and databse are "initial catalog=TunaCoRe" on the first code, and "Database=Ytitnedi" on the second line.
<add name="PersonEntityDbContext" connectionString="metadata=res://*/PersonEntityModel.csdl|res://*/PersonEntityModel.ssdl|res://*/PersonEntityModel.msl;provider=System.Data.SqlClient;provider connection string="data source=humanit3;initial catalog=TunaCoRe;persist security info=True;user id=huma;password=xxxxxxxx;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add connectionString="Server=humanit3;Database=Ytitnedi;User ID=huma;Password=xxxxxxxx" name="DefaultConnection" providerName="System.Data.SqlClient" />
"huma" is a user in SQL Server like "sa". You need to change it to yours.
Nov 25, 2014 04:10 PM|jotavarrichio|LINK
Thank you for your reply, Alvin.
I want to use the option MICROSOFT SQL SERVER DATABASE FILE, but to tell you the truth, even the option MICROSOFT SQL SERVER, shows the same error message.
Nov 25, 2014 04:16 PM|jotavarrichio|LINK
Thanks a lot Jsiahaan, for you reply.
I am using Visual Studio 2012 and doing the connection with Server Explorer. I can't type my connection. I just choose the option and I do the connection test and it is showed a error.
In fact, I don't have experience in SQL Server or Visual Studio. I am just studying a course about OOP programming and this connection is just to study about LINQ topics.
Thanks a bunch and I would be thankfull if someone would have more tips.
Nov 26, 2014 08:37 AM|Kevin Shen - MSFT|LINK
Thanks for your post here.
I suggest that you can connect to (localdb)\v11.0 database in Visual Studio.
First, please choose the "SQL Server Object Explorer" item in the "VIEW" Tab in Visual Studio.
Then ,you can click the "Add" icon to connect to the new sql server ,type "(localdb)\v11.0" as the server name,click the "connect" button.
Here is similar issue which may give you a right direction:
Nov 27, 2014 03:43 PM|jotavarrichio|LINK
Thank you a lot Kevin.
After I have attempted many times to get this connection without success I decided uninstall SQL Server 2012 and I'll try install SQL Server 2008.
When I will complete this task I will follow your valuable tip and as soon as I finish the instalation I will post the answer.
thanks my friend.
Nov 30, 2014 01:35 PM|jotavarrichio|LINK
Thank you Kevin...
it got right .... I used the SQL Server Object Explorer and I could connect my table in SQL and use LINQ to Classes item in VS 2012.The connection worked.
My best regards.