Reputation: 1707
I am using c# to connect to sql server on another computer on the network but i got an exception message Login failed for user ' username' however the server log state that the connection is successful for the user using windows authentication my connection string is:
"Data Source=ipaddress,1433;Initial Catalog=database;Trusted_Connection=True;Integrated Security=False;Connect Timeout=30;user ID=username;password=password"
I am using microsoft sql server 2008 R2
Thanks in advance
Upvotes: 2
Views: 10228
Reputation: 1142
Manage sa account in sql server with username= sa and set password=---- Use this connection string where 1433 is TCP Port
(Server=server_name,1433;Database=------;User ID=sa; Password=-----");
Upvotes: 0
Reputation: 271
There are few things you should check:
Remove "Trusted_Connection=True;" in your connection string
Turn off the firewall on both machines for testing. If it works, you can enable the both of them and then configure the access rights for specific application
Enable SQL Authentication on SQL Server instance: http://kbase.gfi.com/showarticle.asp?id=KBID002804
Simple way to test it works or not without running your c# code: you can install the SQL Management Studio on the code-machine and try to connect the SQL Server instance.
Hope it helps.
Upvotes: 2