I am trying to connect the sql server database using ‘sa’ from my .Net windows application. I am getting the error: Cannot opend . Login failed for sa for . But I am able to connect to same database from Sql Server Management Studio. Please provide me the fix.
Thanks in advance.
Is the SQL Server Management Studio on the same computer that you have your Visual Studio, if yes, then check your connection string, it should be like below:
Provider=SQLOLEDB.1;Password=“Password”;Persist Security Info=True;User ID=“Username”;Initial Catalog=“Initial Database”;Data Source=“Server IP”
If the management studio is not on the Server, then it might be because of a Windows Firewall issue, check the below URL for how to change the firewall settings:
Cannot Login To SQL Server From Network