Click here to Skip to main content
15,909,530 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I installed SQL server express 2014 in one system. I am able to connect that system's sqlserver with my system using with sql server management studio. But same thing I tried from visual C# programatically, I am getting error loging failed user sa. in that system i already enabled sa user login. sqlserver authentication.
So why i am unable to connect that from visual c#.

What I have tried:

I googled but, came with no suitable solution
Posted
Updated 5-Oct-17 21:36pm

Without your code, we can't do anything much.
Except to say "never use the sa login" - create users with the right permissions to do their job and no more, and use those instead.

Then look here: Simple SQL Connection String Creation[^]
 
Share this answer
 
Comments
vijay_bale 6-Oct-17 3:53am    
I added connection string in appconfig file like below
<add name="connectionstr"
connectionString="Data Source=192.168.1.10\SQL2016;Initial Catalog=inventoryDB;Persist Security Info=True;User ID=sa;Password=***********"
providerName="System.Data.SqlClient" />
OriginalGriff 6-Oct-17 4:07am    
Don't use the sa user: it is an admin login and can do anything. Create your own users!

And what happens when you try to connect to that IP address (I'd use the computer name, myself - the IP can change as computers are powered up in a different sequence) using the link I gave you?
vijay_bale 6-Oct-17 4:17am    
As You told I created one new user and give connection string in config file like below
<add name="connectionstr"
connectionString="Data Source=192.168.1.10\SQL2016;Initial Catalog=inventoryDB;User ID=test;Password=***********"
providerName="System.Data.SqlClient" />

I have to try that udl connection string what you told. First I did like this next I will do that also
vijay_bale 6-Oct-17 4:37am    
Now I tried with connectionstring file UDL. I changed ip to system name also. but getting same error
<add name="connectionstr"
connectionString="Persist Security Info=False;User ID=test;Initial Catalog=inventoryDB;Data Source=m3\SQL2016"
providerName="System.Data.SqlClient" />
OriginalGriff 6-Oct-17 4:45am    
And how are you using it? What code are you reading it with, and opening the connection?
Get assistance about connection string using this link
SQL Server connection strings - ConnectionStrings.com[^]
 
Share this answer
 
Have you tried the below guide?? see if these can help you..

[^]

[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900