0

I am having a problem with accessing SQL Server in visual studio. I am reading in a csv file and putting it into a SQL Server database. I am using DBAccees to do this, however, when I run the application, I get a "Login Failed for user" error. I am not sure why it is doing this as the username and password is right.

DBAccess _dba = new DBAccess("server=servername;database=name;password=password;user=username");  

Any help is appreciated

0

2 Answers 2

2

I think the username parameter in the connection string is wrong. change it to:

DBAccess _dba = new DBAccess
                ("server=servername; database=name;password=password;uid=username");
Sign up to request clarification or add additional context in comments.

3 Comments

if i want have to no password, do i need to put password= or just not put it in there at all
well, I am currently using my local machine as the server...Would that cause any problems...and i cant get sql server authentication to work..only windows authentication
Are you able to connect to the server using SQL Server Management Studio and using SQL Authentication?
0

If you cant get SQL server authentication to work, have you verified you have a correctly configured SQL user setup? With access to the correct database? If you don't need to use SQL authentication and want to use Integrated use this for a connection string:

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.