I know this is a pretty standard problem ... but can't figure it out.
So here is what I want to do:
I want to connect to a local sql. \ SQLEXPRESS server by using Windows authentication. I can log in using SQL Server Management Studio.
My connection string looks like this:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Integrated Security=SSPI";
he gives me an error:
Cannot open database "Sports" requested by the login. The login failed.
so i tried:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Trusted_Connection=True";
this gives me:
Invalid authorization specification
Then I tried:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Integrated Security=True";
it returns:
No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).
Any ideas?
Updates: I forgot to mention, I use windows 7 of the virtual machine working with SQL Server Express Express. Is there anything in common with a virtual machine?
source
share