locked
Connectionstring using SQL authentication RRS feed

  • Question

  • User-586180944 posted

    Hi 

    I am using Entity Framework to connect my local SQL server 2014 Express.

    The connection is successful using Window authentication.

    The connectoinstring is as follows:

    <connectionStrings>

        <add connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=SalesERPDB;Integrated Security=True"

              name="SalesERPDAL"      

              providerName="System.Data.SqlClient"/>

      </connectionStrings>

    However, I cannot connect it with SQL authentication.

    The connectionstring is as follows:

    <connectionStrings>

        <add connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=SalesERPDB; User ID=test;Password=11111;Integrated Security=False"

              name="SalesERPDAL"      

              providerName="System.Data.SqlClient"/>

      </connectionStrings>

    I am sure the user ID and password above are correct and user mapping has been correctly configured.

    What else should I look at in solving this connection issue?

    Many thanks in advance.

    Saturday, July 9, 2016 7:22 AM

All replies

  • User753101303 posted

    Hi,

    What else should I look at in solving this connection issue?

    And the error message is? If you just tell that "you cannoct connect" it could be anything (some account policy coming in the way?). If instead you tell the exact error message you have (or the best English translation) it allows to greatly narrow down what could be the issue and allows those trying to help to focus on possible reasons for THIS particular error.

    So please never post about an error you have whithout telling WHICH error you have.

    Sunday, July 10, 2016 6:22 PM
  • User1559292362 posted

    Hi verygaoxing,

    I am sure the user ID and password above are correct and user mapping has been correctly configured.

    What else should I look at in solving this connection issue?

    If you use SQL server 2014 Express. you could also use SQL Server security with a SQL Server Express database: specify the name and password and specify Integrated Security=false.

    Please modify it like this:

    <add connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=SalesERPDB;Integrated Security=False"
    
              name="SalesERPDAL"      
    
              providerName="System.Data.SqlClient"/>
    
      </connectionStrings>
    

    In addition, please check if you have enabled SQL authentication.

    For more information, please refer to (please see 'SQL Server Express Connection String Examples' ):

    https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx#sse

    Best regards,

    Cole Wu

    Tuesday, July 12, 2016 2:02 AM
  • User364663285 posted

    Try to put this

    	<connectionStrings>
    		<add name="conn2" connectionString="Data Source=192.168.?.?\your_db_instance;Initial Catalog=your_db_schema;Integrated Security=False;User ID=your_db_login;Password=??????" providerName="System.Data.SqlClient"/>
    	</connectionStrings>
    



    within Web.config/app.config file in your project, to ensure the project will work fine with the database.

    Wednesday, July 13, 2016 2:22 AM