MVC 4 Connectionstring to SQL Server 2012

后端 未结 5 1329
慢半拍i
慢半拍i 2020-12-29 23:35

I\'ve created a brand new MVC 4 application in C# using Visual Studio 2012. I\'m trying to connect to a brand new SQL Server 2012 (Standard) instance but I can\'t seem to ge

5条回答
  •  孤城傲影
    2020-12-29 23:55

    If you are able to connect using Sql Management Studio then I believe there must be problem with Connection String -

    Connection String You are using follows format -

    Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
    User ID=myDomain\myUsername;Password=myPassword;
    

    Try using IP Address, Port in Data Source field like -

     
        
      
    

    OR try other variations -

    Standard Security

    Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
    

    Trusted Connection

    Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
    

    Connection to a SQL Server instance

    Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;
    Password=myPassword;
    

    Reference - http://www.connectionstrings.com/sql-server-2012

提交回复
热议问题