开发者

sql server 2008 connection string error

开发者 https://www.devze.com 2023-01-25 16:21 出处:网络
I know this i开发者_如何学Pythons a quite standard issue... but can\'t figure it out.. So here\'s what i want to do:

I know this i开发者_如何学Pythons 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消