0

So I'm trying to set up a connectionstring in ASP.NET to connect to a SQL Server. I've got the servername and that's the structure I'm currently using.

 <add name="CRMSQL" connectionString="Data Source=servername\Instance;Initial Catalog=crm;User ID='CRM';Password='****';Integrated Security=True" providerName="System.Data.SqlClient" />

I know that the username and the password are right and for the Servername I use something like U444324.And as the instance name I use the name which pops up when I execute:
SELECT @@servername
What are possible sources of error?

3
  • 1
    Isn't working is not a valid issue description. What is the exact error ? Commented Sep 14, 2015 at 9:28
  • Have you tried to connect to the DB with Sql Server Management Studio? If so then try to use in Data Source exact what you have in the Server Name field of the Connect to Server window Commented Sep 14, 2015 at 9:33
  • @doctor_Nick42 So I connected it in Visual Studio with the SQL Server Object Explorer and it worked. Commented Sep 14, 2015 at 9:37

2 Answers 2

1

Replace Integrated Security=True with Persist Security Info=True

Persist Security = true means that the Password used for SQL authentication is not removed from the ConnectionString property of the connection.

When Integrated Security = true is used then the Persist Security is completely irelevant since it only applies to SQL authentication, not to windows/Integrated/SSPI.

Reference : Differance Between Persist Security Info And Integrated Security

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

Comments

1
  1. Create an empty text file
  2. Change the extension to .udl
  3. Once created, double click on the created file.
  4. You will be presented with a GUI
  5. Follow the steps in Connection tab and click on Test Connection
  6. If successfull, click OK
  7. Then right click on the file and open with note pad
  8. Copy the connection string and replace it with your current one.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.