locked
SQL Server 2012 - Error RRS feed

  • Question

  • User-324178315 posted

    Hello everybody. 

    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.

    John Franco

    Monday, November 24, 2014 5:08 PM

Answers

  • User1918509225 posted

    Hi jotavarrichio,

    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:

    http://geekswithblogs.net/krislankford/archive/2012/06/19/sql-server-2012-express-localdb-how-to-get-started.aspx

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 26, 2014 8:37 AM

All replies

  • User-1295524936 posted

    Hey John,

    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.

    SQL SERVER

    I hope that helped.

    Monday, November 24, 2014 5:52 PM
  • User1751268424 posted

    Hi John,

    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.

      <connectionStrings>
        <add name="PersonEntityDbContext" connectionString="metadata=res://*/PersonEntityModel.csdl|res://*/PersonEntityModel.ssdl|res://*/PersonEntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=humanit3;initial catalog=TunaCoRe;persist security info=True;user id=huma;password=xxxxxxxx;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
        <add connectionString="Server=humanit3;Database=Ytitnedi;User ID=huma;Password=xxxxxxxx" name="DefaultConnection" providerName="System.Data.SqlClient" />
      </connectionStrings>

    "huma" is a user in SQL Server like "sa". You need to change it to yours.

    Have fun

    Monday, November 24, 2014 6:45 PM
  • User-324178315 posted

    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.

    Tuesday, November 25, 2014 4:10 PM
  • User-324178315 posted

    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.

    John Franco

    Tuesday, November 25, 2014 4:16 PM
  • User1918509225 posted

    Hi jotavarrichio,

    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:

    http://geekswithblogs.net/krislankford/archive/2012/06/19/sql-server-2012-express-localdb-how-to-get-started.aspx

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 26, 2014 8:37 AM
  • User-324178315 posted

    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.

    Thursday, November 27, 2014 3:43 PM
  • User-324178315 posted

    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.

    John Franco.

    Sunday, November 30, 2014 1:35 PM