Joe Smith
Joe Smith

Reputation: 205

Problem with SQL Server

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

Upvotes: 0

Views: 137

Answers (2)

David Yenglin
David Yenglin

Reputation: 685

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;

Upvotes: 0

Chandu
Chandu

Reputation: 82913

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");

Upvotes: 2

Related Questions