I know this is a quite standard issue... but can't figure it out..
So here's what i want to do:
I want to connect to my local sql server .\SQLEXPRESS by windows authentication. I can login by using the SQL Server Management Studio.
My connection string is like this:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Integrated Security=SSPI";
it throws 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";
it 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'm using virtual machine windows 7 running the sql server 2010 express. Is there anything to do with the virtual machine???
Are you familiar with http://www.connectionstrings.com ??
I would try something like:
Server=.\\SQLExpress;Database=Sports;Integrated Security=SSPI
That should work, I hope (no need to specify a provider and all that stuff).
Yo,
Do u use some IDE? Like VS2008? First, try restart SqlServer in your Configuration Manager.
User contributions licensed under CC BY-SA 3.0